Can I mount docker host directory as copy on write/overlay? -
i'd mount host directory in docker on outside read/only. i'd appear inside container read/write.
so files/directories can written not changed on outside. possible using kind of overlay process?
this do:
on host:
load directory read only.
docker run --privileged -v /path/on/host:/path/on/client-read-only:ro -it ubuntu /bin/bash
on client:
on client use overlayfs on read-only directory mounted host.
mount -t overlayfs none -o lowerdir=/path/on/client-read-only,upperdir=/path/on/client /path/on/client
then use /path/on/client
read/write files.
edit: if have 3.18+ kernel on host, may prefer using on client:
mount -t overlay overlay -o lowerdir=/path/on/client-read-only,upperdir=/path/on/client,workdir=/path/on/client-workdir /path/on/client
which isn't overlayfs
. overlayfs
had issue regarding being unable use rm
. overlay
solved problem me.