Go up to the main NWS readme (md)
Command | description |
---|---|
docker compose up |
Run the containers |
docker compose up -d |
Run the containers in the background |
docker compose down |
Stop the containers |
docker pull <image> |
Download or update the specified image |
docker images |
See information on the docker images on your host |
docker ps -a |
See what containers are running |
docker network ls |
See the networks configured |
docker kill <cid> |
Kill (stop) a container |
docker rm <cid> |
Remove the (stopped) container |
docker rmi <id> |
Remove a docker image |
docker system prune |
Remove all killed containers and outdated images |
docker exec -it <cid> /bin/bash |
Start a bash shell in container <cid> |
docker login |
Login to a another docker server, if needed |
docker login server:5000 |
Login to a another docker server, if needed |
docker cp <filename> <cid>:/path/to/<filename> |
Copy file into running container |
docker cp <cid>:/path/to/<filename> . |
Copy file from a running container into the current directory |
Note: this has only been tested on an ARM Mac (M1/M2), and not on an Intel x64 Mac. Reference: this article.
docker run hello-world
– you should see an informative messagebrew install socat
brew install xquartz
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
&
to itopen -a Xquartz
:0
)
ifconfig en0
to find out what it is:0
at the end of the IP addressDISPLAY=192.168.14.45:0
(with a -
before it in the docker-compose.yml file)xhost
for your computer’s IP address (again, the one on en0
, not localhost), especially if it’s the first time you are doing this, or if your IP address changed. You can run xhost + 1.2.3.4
, where 1.2.3.4 is your en0
IP address. If it complains that xhost is not found, try entering the command with the full path to xhost: /opt/X11/bin/xhost + 1.2.3.4
. You may have to execute this command each time you restart xquartz to run a GUI.en0
, not localhost) is set correctly throughout the docker-compose.yml file. If not, change it and then restart all the containers (docker compose down
followed by docker compose up
).socat
seems to work best when it is running before you start the docker containers. If you have already started the docker containers, and you either start (or restart) socat, you should restart all the containers (docker compose down
followed by docker compose up
).echo $DISPLAY
. You will likely get something long-winded, like “/private/tmp/com.apple.launchd.NcQwxvwhxe/org.xquartz:0”. Look at the last two characters – in this example, it’s :0
. If yours is a different number (such as :1
), then you have change that throughout the docker-compose.yml file – change all instances of - DISPLAY=1.2.3.4:0
to - DISPLAY=1.2.3.4:1
, where “1.2.3.4” is your IP address (for en0
, not localhost), and :1
is the value you got from the last two characters of echo $DISPLAY
in Xquartz. If you modify your docker-compose.yml file, you have to restart all the containers (docker compose down
followed by docker compose up
).docker exec
, run echo $DISPLAY
, and then export DISPLAY=1.2.3.4:0
where 1.2.3.4 is the IP of your machine (on your LAN), then try running the GUI program again. This will set the DISPLAY variable for that one container – if it’s different (meaning what you got from the echo
command versus what you set with the export
command), you should change it throughout docker-compose.yml, and then restart all the containers (docker compose down
followed by docker compose up
).socat
command, but open -a Xquartz
does NOT open up a window, you will need to do a full reset and restart (but not a reinstall) of the three commands used:killall -9 socat
and/or killall -9 socat1
(this may cause the xquartz window to suddenly appear)lsof -i :6000
; if there are, kill them (kill -9 <PID>
, where <PID>
is the process value in the second column)docker compose down
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
docker compose up
open -a Xquartz
docker exec -it nws-outer1 /bin/bash
echo $DISPLAY
<IP>:0
; if not, set it: export DISPLAY=111.222.333.444:0
; change as necessary, and be sure to put the :0
at the endxeyes
killall -9 socat
This was tested on Ubuntu 22.04. Reference: this article, but not really this article.
docker run hello-world
– you should see an informative messagexhost
is already installed (it probably is) – run which xhost
to checkxhost +local:docker
on your host:0
DISPLAY=:0
, with the -
preceeding itxhost -local:docker
), but it does not seem to be a security issue if you leave it as-isReference: none. Tested on Windows 10 Pro. Because of how WSL works, it is assumed that this will work on any recent version of Windows.
wsl --set-default-version 2
wsl --install -d Ubuntu
--web-download
flag: wsl --install -d Ubuntu --web-download
wsl
in the search boxdocker run hello-world
– you should see an informative messagexhost
program: sudo apt install x11-server-utils
xhost +local:docker
on your host:0
DISPLAY=:0
, with the -
preceeding itxeyes
.docker
will not work in WSL. Wake up Docker Desktop (or restart it) to be able to run the docker
command in WSL.xeyes
, from WSL. If that doesn’t work, then the Docker GUIs won’t (Docker sends the GUI to WSL). Try:
xhost -local:docker
), but it does not seem to be a security issue if you leave it as-is