References:
- moby/moby#8710 (comment)
- https://blog.jessfraz.com/post/docker-containers-on-the-desktop/
- https://sourabhbajaj.com/blog/2017/02/07/gui-applications-docker-mac/
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\" &
Test that Docker/X11 is working by running Firefox within Docker, but its windows appear on your host machine:
IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}'); echo $IP
xhost + $IP
docker run -d --name firefox -e DISPLAY=$IP:0 -v /tmp/.X11-unix:/tmp/.X11-unix jess/firefox
Fetch the pre-built ardupilot/SITL image (see Dockerfile):
docker pull drnic/ardupilot-sitl
To run SITL:
IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}'); echo $IP
xhost + $IP
docker run -ti -e HOST_IP=$IP -e DISPLAY=$IP:0 -v /tmp/.X11-unix:/tmp/.X11-unix -p 14550:14550 drnic/ardupilot-sitl bash
Inside, run:
$ Tools/autotest/sim_vehicle.py --no-rebuild --console --map --out=$HOST_IP:14550 -v APMrover2 -L Kingaroy --no-rebuild
MAVProxy can now connect to the SITL from the host machine:
mavproxy.py --master=0.0.0.0:14550