1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Fix error when a container has no volumes

This commit is contained in:
Julien Duponchelle 2016-02-12 16:25:43 +01:00
parent 1532b3ed9b
commit 85b9620953
No known key found for this signature in database
GPG Key ID: F1E2485547D4595D

View File

@ -133,7 +133,10 @@ class DockerVM(BaseVM):
:returns: Return the path that we need to map to local folders
"""
binds = []
for volume in image_infos.get("ContainerConfig", {}).get("Volumes", {}).keys():
volumes = image_infos.get("ContainerConfig", {}).get("Volumes")
if volumes is None:
return binds
for volume in volumes.keys():
source = os.path.join(self.working_dir, os.path.relpath(volume, "/"))
os.makedirs(source, exist_ok=True)
binds.append("{}:{}".format(source, volume))