In my previous article here, I’ve discussed how can we launch GUI Apps like Firefox Browser, Nautilus File Manager in Docker.
Today, I’m again with another GUI App in Docker container, Spotify.
For a GUI Application to run, we need to have an XServer which is available as part of every Linux Desktop Environment.
For Windows, you can use Xming.
For OSX, you can use Xquarkz.
But within a Container, we don’t have any XServer — so we will:
- Mount the
X11socket residing in
/tmp/.X11-unixon your local machine into
/tmp/.X11-unixin the container.
- share the Host’s DISPLAY environment variable to the Container
- run container with host network driver with
- for sound
Dockerfile to build an image with a Spotify App:
$ cat Dockerfile
$ sudo docker build -t mtabishk/spotify-app .
$ sudo docker run --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --net=host --device /dev/snd mtabishk/spotify-app
You should see the Spotify application now displayed on your Host OS Desktop.
That’s all for today! I’ll be back with some new articles very soon, thanks! 🤗
Muhammad Tabish Khanday