Fix wrong layer ordering
This commit is contained in:
parent
bfd1b7cb2f
commit
a1ceeb1ead
@ -17,8 +17,7 @@ def prepare_container(container, layers):
|
||||
rootfs = os.path.join(LXC_ROOT, container, 'rootfs')
|
||||
# Unmount rootfs in case it remained mounted for whatever reason
|
||||
unmount_rootfs(rootfs)
|
||||
layers = layers.split(',')
|
||||
mount_rootfs(container, layers, rootfs)
|
||||
mount_rootfs(container, layers.split(','), rootfs)
|
||||
|
||||
def mount_rootfs(container, layers, mountpoint):
|
||||
if len(layers) == 1:
|
||||
@ -26,7 +25,7 @@ def mount_rootfs(container, layers, mountpoint):
|
||||
subprocess.run(['mount', '--bind', layers[0], mountpoint])
|
||||
else:
|
||||
olwork = os.path.join(LXC_ROOT, container, 'olwork')
|
||||
subprocess.run(['mount', '-t', 'overlay', '-o', 'upperdir={},lowerdir={},workdir={}'.format(layers[0], ':'.join(layers[1:]), olwork), 'none', mountpoint])
|
||||
subprocess.run(['mount', '-t', 'overlay', '-o', 'upperdir={},lowerdir={},workdir={}'.format(layers[-1], ':'.join(reversed(layers[:-1])), olwork), 'none', mountpoint])
|
||||
|
||||
def unmount_rootfs(mountpoint):
|
||||
if os.path.exists(mountpoint):
|
||||
|
Loading…
Reference in New Issue
Block a user