16

Is it possible to enter a container powered by Google Cloud Run? Something in the manner of docker exec -it CONTAINER /bin/bash?

I'm facing a bug i can't reproduce running a container based on the very same image neither locally nor using Google Cloud Shell to run that container.
I'm not picky regarding whether it comes to using Cloud Shell to connect to Cloud Run or doing so from my local environment.

nichoio
  • 6,289
  • 4
  • 26
  • 33

2 Answers2

10

Is it possible to enter a container powered by Google Cloud Run?

No, the only port you can access the service is $PORT (currently 8080) and only via HTTP/HTTPS requests.

You will need to debug the old fashioned way: logging statements to Google Stackdriver - which is already built-in to Cloud Run, just do "logging.info(...)" for your language.

If your problem is container startup, check Stackdriver for error messages.

John Hanley
  • 74,467
  • 6
  • 95
  • 159
2

Yes you can, with a slight hack - I've released an example here https://github.com/matti/google-cloud-run-shell

You just need to copy these binaries over to your container and establish the reverse shell access through heroku or something similar.

matti
  • 426
  • 3
  • 7
  • 2
    An interesting hack. For those considering this, this will break if more than one instance is running. **Security Warning**: matti/lolbear **authenticates any username as the server username with any password and removes all checks** That is not something I want running attached to my billing account. – John Hanley Nov 24 '21 at 04:07
  • correct, but it also does not and can not listen in public interface due to cloud run limitations. drops auth to convenienve, hence the name LOLbear. – matti Nov 25 '21 at 05:27
  • 1
    I am not sure what you are trying to say. Deploying dangerous code just because you can is not a smart thing to do. If you put a warning in your post that this code is dangerous that would at least warn others of the risks. – John Hanley Nov 25 '21 at 05:42
  • Just tried to give a fair "not as dangerous as you describe it" - thats it. – matti Nov 26 '21 at 11:42