Home > Software engineering >  Create Docker image which prevents volume mounting
Create Docker image which prevents volume mounting

Time:10-12

We have a system in which the user can start sessions inside a number of docker containers. When they do this their home directory is automatically mounted to the docker container. We can't modify the system which starts the docker containers and mounts the directory.

Our goal is to have one image not automatically mount this container. Is there something that I can do to the image to basically make one directory unmountable?

CodePudding user response:

No. If you can docker run a container, you can always use docker run -v to mount any host directory over any directory, and the original contents of the image will be hidden.

Docker's general model is that the image has somewhat limited powers, but you can specify most things when you start the container. Trying to prevent a volume mount (more frequently asked, trying to force a volume mount) is the opposite of this model; the image has no way to prevent how it will eventually be used.

  • Related