Hello all, I made an instance template that loads a docker container in the configuration:
us-docker.pkg.dev/cloudrun/container/hello
I then made a managed instance group. I enabled NAT so that it could pull what it needed to launch the container and it is up and running. I got it up and running, but it keeps failing a health check. That is because HTTPS is not running for the container...
There are no ports, and I don't know how to get a port for an https web server on this. Please advise. I already have a wildcard cert issued for my domain, the docker container is running, just not on right port, i pulled from URL into the template.
I've tried looking at this, to no avail: https://cloud.google.com/compute/docs/containers/configuring-options-to-run-containers#publishing_co...
Thank you.
Solved! Go to Solution.
Hi @nc2,
I found a related topic on StackOverflow that covers a similar issue. As per @holdfenytolvaj you need to add or edit the port binding on the hostconfig.json file at the docker. Additionally, after further review, you may also need to add or edit the config.v2.json file to ensure proper configuration. You can pull up those files at /var/lib/docker/containers/<hash_of_the_container>/. Before you add or edit the json files make sure you stop the docker engine.
Here are the steps I follow to add port in the container:
#Stop the container.
docker stop <container_name>
#Stop the docker service.
sudo systemctl stop docker.socket
sudo systemctl stop docker
#Restart the docker service.
sudo systemctl restart docker
#Edit the hostconfig.json and config.v2.json files (check the given link by @rohitmohta in StackOverflow).
#Restart the docker service.
sudo systemctl restart docker
#Check/Confirm if the changes on the json file are completed.
#Start the docker.
systemctl enable docker
systemctl start docker
For config.v2.json, add/edit the “ExposedPorts” under config and “Ports” under the network settings. And for hostconfig.json, add/edit the “PortBindings”.
I hope the above information is helpful.
Hi @nc2,
I found a related topic on StackOverflow that covers a similar issue. As per @holdfenytolvaj you need to add or edit the port binding on the hostconfig.json file at the docker. Additionally, after further review, you may also need to add or edit the config.v2.json file to ensure proper configuration. You can pull up those files at /var/lib/docker/containers/<hash_of_the_container>/. Before you add or edit the json files make sure you stop the docker engine.
Here are the steps I follow to add port in the container:
#Stop the container.
docker stop <container_name>
#Stop the docker service.
sudo systemctl stop docker.socket
sudo systemctl stop docker
#Restart the docker service.
sudo systemctl restart docker
#Edit the hostconfig.json and config.v2.json files (check the given link by @rohitmohta in StackOverflow).
#Restart the docker service.
sudo systemctl restart docker
#Check/Confirm if the changes on the json file are completed.
#Start the docker.
systemctl enable docker
systemctl start docker
For config.v2.json, add/edit the “ExposedPorts” under config and “Ports” under the network settings. And for hostconfig.json, add/edit the “PortBindings”.
I hope the above information is helpful.