Skip to content

Commit d3d0cc0

Browse files
authored
Merge pull request #2277 from GNS3/fix/2276
Prevent X11 socket file to be modified by Docker container
2 parents 6a614fb + c2783d3 commit d3d0cc0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

gns3server/compute/docker/docker_vm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ async def create(self):
406406
await self._start_vnc()
407407
params["Env"].append("QT_GRAPHICSSYSTEM=native") # To fix a Qt issue: https://github.com/GNS3/gns3-server/issues/556
408408
params["Env"].append("DISPLAY=:{}".format(self._display))
409-
params["HostConfig"]["Binds"].append("/tmp/.X11-unix/:/tmp/.X11-unix/")
409+
params["HostConfig"]["Binds"].append("/tmp/.X11-unix/X{0}:/tmp/.X11-unix/X{0}:ro".format(self._display))
410410

411411
if self._extra_hosts:
412412
extra_hosts = self._format_extra_hosts(self._extra_hosts)

tests/compute/docker/test_docker_vm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ async def test_create_vnc(compute_project, manager):
182182
"Binds": [
183183
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
184184
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network")),
185-
'/tmp/.X11-unix/:/tmp/.X11-unix/'
185+
"/tmp/.X11-unix/X{0}:/tmp/.X11-unix/X{0}:ro".format(vm._display)
186186
],
187187
"Privileged": True
188188
},

0 commit comments

Comments
 (0)