Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

exec into Cloud Run container

can i exec into a Cloud Run container ? is there a command line that would enable me to do so

4 7 9,063
7 REPLIES 7

I don't think there is a way to do that. You can pull and run container image used to debug manually or use the Stackdriver tools.

You can find more details about troubleshooting a Cloud Run service here 👇👇.

https://cloud.google.com/run/docs/tutorials/local-troubleshooting

Happy clouding 😀.

yes thank you, that would debug its docker container locally,

If there's a way to exec into its container in prod that would be great as my Cloud Run service in prod is connected with compute engine vm internally though vpc connector, and i want to check if it's getting the data from the vm.

as a DevOps i usually exec into containers and run some commands to check everything is well, rather than modify the code of the developers

Cloud run is a fully managed service and does not allow exec into the container.

You can use Stackdriver logs to check everything working fine in production.

 

I hope someday that becomes possible!

just write some shell scripts of the commands you want to execute and run the shell script file on application start or anywhere in your code

This feature would be beneficial, particularly when migrating a Docker-based application to Cloud Run. Additionally, AWS ECS has supported this for years.

https://dev.to/aws-builders/how-to-run-a-shell-on-ecs-fargate-containers-eo1

 

As mentioned AWS provides this feature on Fargate - which is also a Fully managed service. It's super useful and can do away with the need for a bastion host on a VM.