This blog lets discuss how the Docker image can be deployed on GCP with the help of cloud-run services. If you are looking to deploy your web app or dashboard without any trouble then this is the right place.
Let's get the list of requirements:
- Install docker on your machine.
- Should have GCP access (you can get a free trial for 3 months).
- Install gcloud cli on your machine.
- A docker image that you need to deploy.
Assuming the above requirements have been satisfied. Let's start with the steps to deploy docker on Cloud run.
Step 1:
- Make sure cloud run API and container registry API has been enabled in the Gcloud.
Step 2:
- Installing Docker requirements to gcloud.
In order to manage your private docker registry, you need to authenticate first. It can be done but Google container registry credential Helper for Docker.
gcloud components install docker-credential-gcr
docker-crendential-gcr configure-docker
- Pushing the image to the container registry.
Now push the image from your local docker to the container registry using the following commands. To select the location you can see the official documents.
docker tag your_image:version gcr.io/project_id/image_name:version
docker push gcr.io/project_id/image_name:version
Now you can see the docker images in the container registry.
The docker images will be somewhat as shown in the above image.
Step 3:
Once the images in uploaded successfully, you can deploy using Cloud-run.
Select the image version properly and click on the 3 dots at the side. Now select Deploy on Cloud Run.
Once you click on deploy you can see the docker images start building and then once successful you can get the link for your app.
Now the app is up and running and view your app in the generated link.
Here you are at the end of this blog. Hope you enjoyed this blog and got an idea of how to deploy your docker image on cloud run.
If you liked the content do follow me for more content on GCP.
Let me know in the comment section if you have any Clarification.