Image for post
Image for post

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.

Image for post
Image for post

But within a Container, we don’t have any XServer — so we will:

  • Mount the X11 socket residing in /tmp/.X11-unix on your local machine into /tmp/.X11-unix in the container.

-v /tmp/.X11-unix:/tmp/.X11-unix

  • share the Host’s DISPLAY environment variable to the Container


  • run container with host network driver with


  • for sound

--device /dev/snd

Dockerfile to build an image with a Spotify App:

$ cat Dockerfile

$ sudo docker build -t mtabishk/spotify-app .

Docker Hub:

$ sudo docker run --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --net=host --device /dev/snd mtabishk/spotify-app

Image for post
Image for post

You should see the Spotify application now displayed on your Host OS Desktop.

Video Demo:

That’s all for today! I’ll be back with some new articles very soon, thanks! 🤗

Muhammad Tabish Khanday


Lets code 💻.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store