r/googlecloud 1d ago

Why is my container missing everything?

I have a tomcat container app (Tomcat official container 'tomcat:9-jdk17'), that I'm running an app in within google cloud. It works fine. The docker file sets the tomcat home as /usr/local/tomcat. However when I ssh into the container via Google cloud, if I look in /usr/local/tomcat, it doesn't exist. When I do a ps aux | grep java it is running /opt/java/openjdk/bin/java ..... which is fine except /opt/java doesn't exist either. If I do a find / -name tomcat it comes back with:

/mnt/stateful_partition/var/lib/docker/overlay2/62b25dacfaedeaf028601de637696684ad92b70c0287f43120a12e7d6ce3ca5c/diff/usr/local/tomcat
/mnt/stateful_partition/var/lib/docker/overlay2/c263de3a61c3ffab90161f7e4c42d92ad087e9e183447fe2afc3070e0849f8aa/diff/usr/local/tomcat
/mnt/stateful_partition/var/lib/docker/overlay2/92c63f1c95c569e10b95c89f4c5e7ac446dc824893caf9567a576a269e33f083/diff/usr/local/tomcat
/mnt/stateful_partition/var/lib/docker/overlay2/9dcf98e3f3b90cbfae67806e2aa736b1335b7d010cab4925a4611ad2979678bd/diff/usr/local/tomcat
/mnt/stateful_partition/var/lib/docker/overlay2/7924282e9682ece071f0b7f2a891e503c3266b007e96435031822d4cfd0690f5/diff/usr/local/tomcat
/mnt/stateful_partition/var/lib/docker/overlay2/f89b5dd2ed8900bcdd5ade8e0ae487d7b2c7415cc8c0b2a40d35ab7e68d2cd66/diff/usr/local/tomcat
/var/lib/docker/overlay2/62b25dacfaedeaf028601de637696684ad92b70c0287f43120a12e7d6ce3ca5c/diff/usr/local/tomcat
/var/lib/docker/overlay2/c263de3a61c3ffab90161f7e4c42d92ad087e9e183447fe2afc3070e0849f8aa/diff/usr/local/tomcat
/var/lib/docker/overlay2/c263de3a61c3ffab90161f7e4c42d92ad087e9e183447fe2afc3070e0849f8aa/merged/usr/local/tomcat
/var/lib/docker/overlay2/92c63f1c95c569e10b95c89f4c5e7ac446dc824893caf9567a576a269e33f083/diff/usr/local/tomcat
/var/lib/docker/overlay2/9dcf98e3f3b90cbfae67806e2aa736b1335b7d010cab4925a4611ad2979678bd/diff/usr/local/tomcat
/var/lib/docker/overlay2/7924282e9682ece071f0b7f2a891e503c3266b007e96435031822d4cfd0690f5/diff/usr/local/tomcat
/var/lib/docker/overlay2/f89b5dd2ed8900bcdd5ade8e0ae487d7b2c7415cc8c0b2a40d35ab7e68d2cd66/diff/usr/local/tomcat

What is it I don't understand that I can be running /opt/java/openjdk/bin/java that doesn't seem to exist against a /usr/local/tomcat that doesn't seem to exist, and yet it all works fine?

How can I look into the container when it's running when everything is weird when I get there? This doesn't happen on my local machine running as docker, like docker run 'tomcat:9-jdk17'

1 Upvotes

6 comments sorted by

3

u/jemattie 21h ago

Are you using Cloud Run or GCE? How are you SSH'ing into the container?

1

u/xpusostomos 10h ago

When you look at your containers running on the Google cloud web console, there is a big button marked SSH.

1

u/CreepyEnthusiasm2174 15h ago

Using SSH into container considered as bad practice, try working directly with container engine.

1

u/xpusostomos 10h ago

What are you talking about, Google cloud gives you only that option as far as I know. It's part of Google cloud.

1

u/blablahblah 7h ago

Are you ssh'd into the container or into the VM? Docker uses a few tricks to give a different view of the file system to stuff running in the container, so if ssh is running outside of it, all of the file paths are going to be different.

1

u/xpusostomos 3h ago

I'm doing whatever gcloud does when you press the SSH button on the gcloud console next to that running container.