Incapio - Blog Posts © 2022 by Incapio is licensed under CC BY-SA 4.0 

Install Portainer on Cloud Run | Google Cloud(GCP)

Updated: Jan 28

Prerequisites:

You will need the following items to complete this tutorial.

  • A Portainer image in Google Container Registry.

  • A Domain (Registered in any hosting provider)

Step - 1. Add the Portainer image to Container Registry.

  • Select or create a Google Cloud project from the project selection page in the Google Cloud Console.

  • Make sure your Cloud project's billing is turned on.

  • Allow the Container Registry API to be used.

  • Navigate to the container registry in the Google cloud console and open cloud shell access to pull the portainer community editions from the docker. Lastly, push the portainer image to the container registry using the following commands.

  • Syntax:

docker pull portainer/portainer-ce
docker tag portainer/portainer-ce gcr.io/<project-id>/portainer-community-edition
docker push gcr.io/<project-id>/portainer-community-edition
  • Example:

docker pull portainer/portainer-ce
docker tag portainer/portainer-ce gcr.io/elegant-canto-331917/portainer-community-edition
docker push gcr.io/elegant-canto-331917/portainer-community-edition
Container Registry, Images, Settings, portainer
Container Registry Interface
  • To learn more about container registry pulling and pushing images. Visit the link here.

  • To learn more about deleting an image from the container registry, visit the link.

Step - 2. Install Portainer on Cloud Run.

  • Navigate to the Cloud Run interface in the Google cloud console and click on the "Create Service" option to deploy the portainer.

  • Choose the "Deploy one revision from an existing container image" option in the create service interface and select the portainer image from the container registry.

Container Registry, image, region, portainer
Container Registry Images
  • Then, type the service name and choose the region.

  • Next, specify the CPU allocation, pricing and auto-scaling options. Also, select the "Allow all traffic" option in the ingress and select the "Allow unauthenticated invocations" in the Authentication.

  • Lastly, Expand the "Container, Variables & Secrets, Connections, Security" option and type "9000" in the container port under the container tab.

  • Finally, click on the "create" option to deploy the portainer.

Cloud Run, Portainer
Portainer Deployment
  • For portainer initial setup, click on the URL at the top of the deployment.

  • To learn more about portainer basic setup. Visit the link here.

Step - 3. Setting up a custom domain.

  • Navigate to the Cloud Run interface and click on the "Manage Custom Domains" option,

  • Click on the "Add Mapping" option in the Manage Custom Domains interface to point to your custom domain.

domain, Cloud Run, Portainer
Mapping Custom Domain
  • Select the service to which you're mapping the custom domain from the Add Mapping interface.

  • Enter your domain name and click on continue to verify ownership of the domain.

  • Unless you bought your domain from Google, you must prove ownership before using it.

  • In case, If you have already verified the ownership of the domain, choose the domain from the "Select a verified domain" drop-down list and type the subdomain name in the "Specify Subdomain" field or leave it to a blank to point to the root domain.

  • Then, click on the "continue" option to update your DNS record at your domain registrar.

DNS, Cloud Run, Add Mapping, Custom domain, Portainer
Update DNS Records
  • In this tutorial, I will use a domain name registered at GoDaddy. In case, If your domain registered with another hosting provider. Update the DNS record as per your hosting provider guidelines.

GoDaddy, Cloud Run, Portainer, Custom Domain
GoDaddy DNS Record
  • Lastly, add a CNAME record in your domain DNS points to "ghs.googlehosted.com."

  • Finally, Click on the "Done" option in the add mapping interface.

Portainer, Cloud Run, GCP, Google Cloud
Portainer Initial Setup

Conclusion

Here are some recommended tips and tricks.

170 views0 comments

Do you need assistance? Visit Forum to join the conversation.