قالب وردپرس درنا توس
Home / Tips and Tricks / How to run Docker Containers on Google Cloud Platform – CloudSavvy IT

How to run Docker Containers on Google Cloud Platform – CloudSavvy IT



dock workers

The Google Cloud Platform has many tools for working with and running container apps with Docker, including managed Kubernetes and serverless container design. We discuss how to get a container service that runs on GCP.

Which service should you use?

You basically have two options for running containers. The first is Cloud Run, which is very simple and easy to use and will get the job done for most people. Containers are treated as “services”

;, which are allocated a certain amount of memory and a CPU core (or two) to use. You can create custom domains for the containers and run apps from different ports.

If you just want to run a simple deployment without using compute engine instances like an NGINX web server, Cloud Run works well for you. If you have used AWS ECS, Cloud Run is a good replacement. But if you need a more complex distribution or need to implement specific rules for auto-scaling and orchestration, you may want to look at Kubernetes Engine, which runs a managed K8 cluster.

Google also runs a container registry service called the Google Container Registry, which you can use to run updates to images and archives for use in Cloud Run and the Kubernetes Engine.

If you do not need all the nice features that an orchestration engine like Kubernetes offers and just want to run a few containers, Cloud Run will handle it well, and that’s what we’re focusing on here. To learn more about running a fleet of containers on the Kubernetes Engine, read on Google’s guides on how to set it up.

Get started with Cloud Run

Go to the Google Cloud Platform Console and select Create Service.

create service

Select the region you want it to run in and name it.

select region

You can also choose to secure this container with Cloud IAM. This is most useful if you distribute internal services and want to secure them so that only authorized users or service accounts can access them. If you select this, you must grant IAM permission to the specified user accounts in order for them to access this service.

In the next step, you configure the first version of the container service with a URL for an image. This can be from the Docker registry, or you can use the Google Container Registry.

set container image

Under “Advanced settings” you can configure which port is to be sent to the container, as well as any specific entry points and arguments you need.

set container settings

Under “Capacity” you can change the limit for simultaneous request, timeout for request, number of CPU cores and memory allocated to each instance. This should optimally be enough to run an instance of your app – if you need more capacity, auto-scaling will scale it up.

set CPU and memory

Auto-scaling is done automatically, but you can lower the number of maximum instances if you are worried about the cost.

auto scaling setting

When you click on “Create”, the service starts. You will be able to see its details from the Cloud Run console. The URL for connecting to the container can be displayed from this panel. Of course, you can use a custom domain to map to a container, but using it with a CNAME also works.

cloud drive console

If you go to this web address, your container service will start running.

cloud drive service running


Source link