Skip to content

Commit

Permalink
[update] revert mac docker run
Browse files Browse the repository at this point in the history
  • Loading branch information
tancheng committed Oct 7, 2024
1 parent 3689320 commit ada7dd3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
15 changes: 15 additions & 0 deletions run_linux_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

IMAGE=cgra/cgra-flow:demo

CONTAINER=CGRA-Flow-OpenRoad

XSOCK=/tmp/.X11-unix

sudo docker run \
-it \
--name=$CONTAINER \
-v $XSOCK:$XSOCK:rw \
-e DISPLAY=unix$DISPLAY \
$IMAGE

24 changes: 17 additions & 7 deletions run_mac_docker.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
#!/usr/bin/env bash

IMAGE=cgra/cgra-flow:demo
CONTAINER=cgra/cgra-flow:demo
COMMAND=/bin/bash
NIC=en0

CONTAINER=CGRA-Flow-OpenRoad
# Grab the ip address of this box
IPADDR=$(ifconfig $NIC | grep "inet " | awk '{print $2}')
DISP_NUM=$(jot -r 1 100 200) # random display number between 100 and 200
PORT_NUM=$((6000 + DISP_NUM)) # so multiple instances of the container won't interfer with eachother
socat TCP-LISTEN:${PORT_NUM},reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\" 2>&1 > /dev/null &

XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth.$USER.$$
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -

sudo docker run \
docker run \
-it \
--name=$CONTAINER \
--rm \
-v $XSOCK:$XSOCK:rw \
-e DISPLAY=unix$DISPLAY \
$IMAGE

-v $XAUTH:$XAUTH:rw \
-e DISPLAY=$IPADDR:$DISP_NUM \
-e XAUTHORITY=$XAUTH \
$CONTAINER

0 comments on commit ada7dd3

Please sign in to comment.