From a1ceeb1ead4f254fc285aabab0251beb85992bf3 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 21 Dec 2019 17:44:27 +0100 Subject: [PATCH] Fix wrong layer ordering --- usr/lib/python3.6/lxcmgr/lxcmgr.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/usr/lib/python3.6/lxcmgr/lxcmgr.py b/usr/lib/python3.6/lxcmgr/lxcmgr.py index 2edb240..248efa2 100644 --- a/usr/lib/python3.6/lxcmgr/lxcmgr.py +++ b/usr/lib/python3.6/lxcmgr/lxcmgr.py @@ -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):