diff --git a/gns3server/modules/docker/docker_vm.py b/gns3server/modules/docker/docker_vm.py index 526d8299..b02a09d8 100644 --- a/gns3server/modules/docker/docker_vm.py +++ b/gns3server/modules/docker/docker_vm.py @@ -294,6 +294,8 @@ class DockerVM(BaseVM): # Give the information to the container on how many interface should be inside params["Env"].append("GNS3_MAX_ETHERNET=eth{}".format(self.adapters - 1)) + # Give the information to the container the list of volume path mounted + params["Env"].append("GNS3_VOLUMES={}".format(":".join(self._volumes))) if self._environment: params["Env"] += [e.strip() for e in self._environment.split("\n")] diff --git a/tests/modules/docker/test_docker_vm.py b/tests/modules/docker/test_docker_vm.py index d4b0bfe3..33e3f311 100644 --- a/tests/modules/docker/test_docker_vm.py +++ b/tests/modules/docker/test_docker_vm.py @@ -104,7 +104,8 @@ def test_create(loop, project, manager): "Hostname": "test", "Image": "ubuntu:latest", "Env": [ - "GNS3_MAX_ETHERNET=eth0" + "GNS3_MAX_ETHERNET=eth0", + "GNS3_VOLUMES=/etc/network" ], "Entrypoint": ["/gns3/init.sh"], "Cmd": ["/bin/sh"] @@ -141,8 +142,9 @@ def test_create_with_tag(loop, project, manager): "Hostname": "test", "Image": "ubuntu:latest:16.04", "Env": [ - "GNS3_MAX_ETHERNET=eth0" - ], + "GNS3_MAX_ETHERNET=eth0", + "GNS3_VOLUMES=/etc/network" + ], "Entrypoint": ["/gns3/init.sh"], "Cmd": ["/bin/sh"] }) @@ -183,8 +185,9 @@ def test_create_vnc(loop, project, manager): "Image": "ubuntu:latest", "Env": [ "GNS3_MAX_ETHERNET=eth0", + "GNS3_VOLUMES=/etc/network", "DISPLAY=:42" - ], + ], "Entrypoint": ["/gns3/init.sh"], "Cmd": ["/bin/sh"] }) @@ -225,8 +228,9 @@ def test_create_start_cmd(loop, project, manager): "Hostname": "test", "Image": "ubuntu:latest", "Env": [ - "GNS3_MAX_ETHERNET=eth0" - ] + "GNS3_MAX_ETHERNET=eth0", + "GNS3_VOLUMES=/etc/network" + ] }) assert vm._cid == "e90e34656806" @@ -257,6 +261,7 @@ def test_create_environment(loop, project, manager): }, "Env": [ "GNS3_MAX_ETHERNET=eth0", + "GNS3_VOLUMES=/etc/network", "YES=1", "NO=0" ], @@ -315,8 +320,9 @@ def test_create_image_not_available(loop, project, manager): "Hostname": "test", "Image": "ubuntu:latest", "Env": [ - "GNS3_MAX_ETHERNET=eth0" - ], + "GNS3_MAX_ETHERNET=eth0", + "GNS3_VOLUMES=/etc/network" + ], "Entrypoint": ["/gns3/init.sh"], "Cmd": ["/bin/sh"] }) @@ -534,7 +540,8 @@ def test_update(loop, vm): "Hostname": "test", "Image": "ubuntu:latest", "Env": [ - "GNS3_MAX_ETHERNET=eth0" + "GNS3_MAX_ETHERNET=eth0", + "GNS3_VOLUMES=/etc/network" ], "Entrypoint": ["/gns3/init.sh"], "Cmd": ["/bin/sh"] @@ -601,7 +608,8 @@ def test_update_running(loop, vm): "Hostname": "test", "Image": "ubuntu:latest", "Env": [ - "GNS3_MAX_ETHERNET=eth0" + "GNS3_MAX_ETHERNET=eth0", + "GNS3_VOLUMES=/etc/network" ], "Entrypoint": ["/gns3/init.sh"], "Cmd": ["/bin/sh"]