I have a set of directories that I would like to overlay mount into a container:
# On host
/opt/a
- bin
- lib
/opt/b
- bin
- lib
/opt/c
- bin
- lib
# In container
/usr/local
- bin
- lib
- cuda
I am able to create an overlayfs mount on the host machine for /opt/{a,b,c}
and mount that as a volume to /usr/local
in the container, but then /usr/local/cuda
will be inaccessible in the container.
I'm able to achieve this directly with systemd-nspawn
with the following:
systemd-nspawn --overlay /opt/a:/opt/b:/opt/c:/usr/local <other flags>
This makes all the files available as a merged mount in /usr/local
in the container, with changes written to /opt/c
on the host.
Is it possible to easily achieve what I want with docker?