In an earlier post I wrote instructions for running graphical applications out of Docker containers on my Mac. Since I wrote that post, I have wiped my Mac and reinstalled everything, including Docker for Mac. This post is an update of those instructions.
The steps for running graphical applications from Docker on a Mac have simplified quite a bit. These instructions assume you have Docker for Mac installed and running and have access to container images. Without further ado, here are the instructions:
- Install XQuartz from https://www.xquartz.org/. This MUST be done. The separate installation is required for the graphical applications to run on the Mac host from a Docker container.
- Logout and log back into the Mac. This is necessary to use XQuartz.
- Open XQuartz. From a terminal, execute the following command:
open -a XQuartz
- In the XQuartz terminal window, execute the command:
xhost +
This command may be a little insecure; I haven't researched it fully yet. - Run your Docker container, passing the DISPLAY environment variable with a command like:
docker run --rm -it -e DISPLAY=192.168.1.1:0 ubuntu:latest /bin/bash
192.168.1.1 is a sample IP address. Use the IP address of your system there. - Within the Docker container, run an application with a graphical interface. This should display on the Mac.
- Enjoy!
No comments:
Post a Comment