Fix run Docker containers with user namespaces enabled. Fixes #2414

This commit is contained in:
grossmj
2024-10-26 19:03:05 +10:00
parent dbe2b8a5fb
commit 48b7e6ca50
2 changed files with 32 additions and 31 deletions

View File

@ -383,8 +383,8 @@ class DockerVM(BaseNode):
"CapAdd": ["ALL"],
"Privileged": True,
"Binds": self._mount_binds(image_infos),
"UsernsMode": "host",
},
"UsernsMode": "host",
"Volumes": {},
"Env": ["container=docker"], # Systemd compliant: https://github.com/GNS3/gns3-server/issues/573
"Cmd": [],
@ -451,6 +451,7 @@ class DockerVM(BaseNode):
if extra_hosts:
params["Env"].append("GNS3_EXTRA_HOSTS={}".format(extra_hosts))
print(params)
result = await self.manager.query("POST", "containers/create", data=params)
self._cid = result['Id']
log.info("Docker container '{name}' [{id}] created".format(name=self._name, id=self._id))