I'm using the gcloud compute instances create-with-container
tool to create a VM in GCE where I want to run a docker image. For this i'm using one of google's container-optimized OS images. I'm trying to attach a disk because I need to have persistent data in my docker container. For that, i'm using the --container-mount-disk flag.
The problem I'm having is that the disk gets mounted as a folder owned by root inside the docker container (and in the host VM) and my container process cannot write to it. Is there a way to fix this? I tried using --container-mount-host-path
as well without luck. I tried connecting to the docker host and chown
ing the folder to the uid of the user in the docker container, but the moment the VM gets recreated, the folder is again owned by root so this is not a permanent solution.
In short, how is this --container-mount-disk
feature supposed to be used with non-root users inside the docker container?