I am trying to figure out how mounts work in GCE with a hello-world program. I have an existing image and when I create a VM instance in GCE, I select this existing image. For the command, I enter echo
with the argument "hello world"
. When the VM starts up, I can see this printed in the logs so I know it's running properly.
Before creating the VM instance, I created a standard persistent disk. When creating the VM, I chose "add volume." I specified these details for the volume:
- Volume Type: disk
- Mount path: /hello-world-data
- Disk name: hello-world-test
- Partition:
- Mode: Read/write
After my VM is running and I see "hello world" in the logs, I go to the VM instances page and select "SSH" on the instance. This successfully opens a cloud terminal, and I'm at a prompt which properly reads <username>@hello-world-test-instance ~ $
.
I ls -la
, and I do not see the volume I specified: /hello-world-data
.
I thought maybe it will exist when created, so I try:
cd /
mkdir hello-world-data
But I get this error:
mkdir: cannot create directory ‘hello-world-data’: Read-only file system
Now I'm confused. I created a disk, specified a mount path, and selected read/write. What's going on?
After some exploring, I see that this path exists:
/mnt/disks/gce-containers-mounts/gce-persistent-disks/hello-world-test
What's that? No docs told me about this several-directories deep path. I see if I can at least write anything inside that directory:
$ cd /mnt/disks/gce-containers-mounts/gce-persistent-disks/hello-world-test
$ touch test.txt
touch: cannot touch 'test.txt': Permission denied
On top of this, I do not even see the executables created by my Dockerfile which should be placed into the /bin
directory.
So, I'm lost. Where's the volume? Why is it not at the specified mount path? Why does /bin
not contain the executables created by the Dockerfile?
Thank you