-
-
Save larroy/036785d9f1389ee2d8dbcd8f76906c10 to your computer and use it in GitHub Desktop.
Mount a read-only folder inside a Docker container with OverlayFS on top
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On the host to run the container | |
docker run --privileged -i -t -v ~/host-folder-to-mount:/root/folder-ro:ro ubuntu | |
# Inside the container | |
# Need to create the upper and work dirs inside a tmpfs. | |
# Otherwise OverlayFS complains about AUFS folders. | |
mkdir -p /tmp/overlay && \ | |
mount -t tmpfs tmpfs /tmp/overlay && \ | |
mkdir -p /tmp/overlay/{upper,work} && \ | |
mkdir -p /root/folder && \ | |
mount -t overlay overlay -o lowerdir=/root/folder-ro,upperdir=/tmp/overlay/upper,workdir=/tmp/overlay/work /root/folder |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment