Skip to content

Commit

Permalink
explicitly launch xserver on mac
Browse files Browse the repository at this point in the history
closes #1
  • Loading branch information
lreiher committed Jun 11, 2023
1 parent 310f2f0 commit 9100675
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docker-run-cli/src/docker_run/plugins/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def x11GuiForwardingFlags(cls, docker_network: str = "bridge") -> List[str]:
display = os.environ.get("DISPLAY")
if display is None:
return []

if cls.OS == "Darwin":
runCommand(f"xhost +local:")

xsock = "/tmp/.X11-unix"
xauth = tempfile.NamedTemporaryFile(prefix='.docker.xauth.', delete=False).name
Expand All @@ -101,9 +104,9 @@ def x11GuiForwardingFlags(cls, docker_network: str = "bridge") -> List[str]:
os.chmod(xauth, 0o777)

if docker_network != "host" and not display.startswith(":"):
display="172.17.0.1:" + display.split(":")[1]
display = "172.17.0.1:" + display.split(":")[1]
if cls.OS == "Darwin":
display="host.docker.internal:" + display.split(":")[1]
display = "host.docker.internal:" + display.split(":")[1]

flags = []
flags.append(f"--env DISPLAY={display}")
Expand Down

0 comments on commit 9100675

Please sign in to comment.