diff --git a/usr/bin/lxchelper b/usr/bin/lxchelper index f5ba5cb..3afc20e 100755 --- a/usr/bin/lxchelper +++ b/usr/bin/lxchelper @@ -60,7 +60,7 @@ parser_cleanup.add_argument('container', help='Container name') parser_cleanup.add_argument('lxc', nargs=argparse.REMAINDER) parser_extract = subparsers.add_parser('extract', help='Extracts files or directories from containers rootfs (excluding persistent mounts)') -parser_cleanup.set_defaults(action='extract') +parser_extract.set_defaults(action='extract') parser_extract.add_argument('container', help='Container name') parser_extract.add_argument('source', help='Source file or directory within the container') parser_extract.add_argument('destination', help='Destination file or directory on the host') diff --git a/usr/lib/python3.6/lxcmgr/lxcmgr.py b/usr/lib/python3.6/lxcmgr/lxcmgr.py index 0af3fe6..e3aa810 100644 --- a/usr/lib/python3.6/lxcmgr/lxcmgr.py +++ b/usr/lib/python3.6/lxcmgr/lxcmgr.py @@ -20,7 +20,7 @@ def prepare_container(container, layers): layers = layers.split(',') mount_rootfs(container, layers, rootfs) -def mount_rootfs(container, layers, mountpoint) +def mount_rootfs(container, layers, mountpoint): if len(layers) == 1: # We have only single layer, no overlay needed subprocess.run(['mount', '--bind', layers[0], mountpoint]) @@ -74,6 +74,8 @@ def create_container(container, image): def destroy_container(container): # Remove container configuration and directories + rootfs = os.path.join(LXC_ROOT, container, 'rootfs') + unmount_rootfs(rootfs) try: shutil.rmtree(os.path.join(LXC_ROOT, container)) except FileNotFoundError: