Reputation: 351
I want to achieve the following with Docker: I want to give a container access to a host directory, such that the container can make changes, but the changes are discarded once the container is exiting/removed (pretty much like an overlayfs).
Simply mounting the directory as a volume for the docker container seems like the wrong way to me, since changes made to a volume persist and I don't want that.
How do I tackle this problem?
Upvotes: 1
Views: 375
Reputation: 194
The only way for a container to modify the host is to mount a directory between the host and the container. But the changes made by host or container will persist. You could try the other way: COPY the files you want from host to container using a Dockerfile. The files will be only on the container. When you remove and launch another one, the new container will start with the original files.
Upvotes: 0