[lxc-users] How to control order of bind mounts?
Ben Warren
ben at skyportsystems.com
Tue Dec 12 14:51:28 UTC 2017
Hi,
I have a container with two overlapping bind mounts. I’m seeing that the order in which they are applied does not seem to be consistent.
Here’s a dump of the commands used:
# Create a container from local image
/usr/bin/lxc init local:c1 c1
# Add four bind mounts
/usr/bin/lxc config device add c1 build disk source=/home/ben/src path=/src
/usr/bin/lxc config device add c1 bincd disk source=/home/ben/src/sc/bin-cd path=/src/sc/bin
/usr/bin/lxc config device add c1 pkgcd disk source=/home/ben/src/sc/pkg-cd path=/src/sc/pkg
/usr/bin/lxc config device add c1 home disk source=/home/ben path=/home/ben
#set a bunch of config
/usr/bin/lxc config set c1 environment.PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/src/sc/bin
/usr/bin/lxc config set c1 environment.GOPATH /src/sc
/usr/bin/lxc config set c1 environment.SC_HOSTNAME localhost
/usr/bin/lxc config set c1 environment.WORKSPACE /
/usr/bin/lxc config set c1 environment.PYTHONPATH /src/sc/src
/usr/bin/lxc config set c1 raw.idmap "both 1001 0"
/usr/bin/lxc config set c1 raw.lxc lxc.aa_profile=unconfined
/usr/bin/lxc config device add c1 loop0 unix-block path=/dev/loop0
/usr/bin/lxc config device add c1 loop1 unix-block path=/dev/loop1
/usr/bin/lxc config device add c1 loop2 unix-block path=/dev/loop2
/usr/bin/lxc config device add c1 loop3 unix-block path=/dev/loop3
/usr/bin/lxc config device add c1 loop4 unix-block path=/dev/loop4
/usr/bin/lxc config device add c1 loop5 unix-block path=/dev/loop5
/usr/bin/lxc config device add c1 loop6 unix-block path=/dev/loop6
/usr/bin/lxc config device add c1 loop7 unix-block path=/dev/loop7
/usr/bin/lxc config device add c1 loop-control unix-char path=/dev/loop-control
# Start the container
/usr/bin/lxc start c1
What I see is that sometimes (but not always) the “build” mount overlaps the “bincd” mount, instead of the other way around. Note that these mounts are configured before the container is started. Is it better to start the container first, or is there a way to specify deterministically which order the bind mounts will be applied?
Version info:
ben at skycontrol:~$ lxc --version
2.0.10
ben at skycontrol:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS”
thanks,
Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3866 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20171212/6384bf69/attachment.bin>
More information about the lxc-users
mailing list