diff --git a/gns3server/compute/docker/docker_vm.py b/gns3server/compute/docker/docker_vm.py index a059af78..4ac9e21d 100644 --- a/gns3server/compute/docker/docker_vm.py +++ b/gns3server/compute/docker/docker_vm.py @@ -236,6 +236,7 @@ class DockerVM(BaseNode): """ path = os.path.join(self.working_dir, "etc", "network") os.makedirs(path, exist_ok=True) + open(os.path.join(path, ".gns3_perms"), 'a').close() os.makedirs(os.path.join(path, "if-up.d"), exist_ok=True) os.makedirs(os.path.join(path, "if-down.d"), exist_ok=True) os.makedirs(os.path.join(path, "if-pre-up.d"), exist_ok=True) diff --git a/gns3server/compute/docker/resources/init.sh b/gns3server/compute/docker/resources/init.sh index 7aa862f8..ee98bebd 100755 --- a/gns3server/compute/docker/resources/init.sh +++ b/gns3server/compute/docker/resources/init.sh @@ -35,17 +35,17 @@ do mkdir -p "$i" # Copy original files if destination is empty (first start) - [ "$(ls -A "/gns3volumes$i")" ] || cp -a "$i/." "/gns3volumes$i" + if [ ! -f "/gns3volumes$i/.gns3_perms" ]; then + cp -a "$i/." "/gns3volumes$i" + touch "/gns3volumes$i/.gns3_perms" + fi mount --bind "/gns3volumes$i" "$i" - if [ -f "$i/.gns3_perms" ] - then - while IFS=: read PERMS OWNER GROUP FILE - do - [ -L "$FILE" ] || chmod "$PERMS" "$FILE" - chown -h "${OWNER}:${GROUP}" "$FILE" - done < "$i/.gns3_perms" - fi + while IFS=: read PERMS OWNER GROUP FILE + do + [ -L "$FILE" ] || chmod "$PERMS" "$FILE" + chown -h "${OWNER}:${GROUP}" "$FILE" + done < "$i/.gns3_perms" done