Sign inSign up

plugndock/ubuntu-x

By plugndock

•Updated almost 4 years ago

An Ubuntu image containing the complete set of Ubuntu-desktop tools, instantly ready using X11.

Image
Operating systems
0

215

plugndock/ubuntu-x repository overview

WARNING: THIS CONTAINER IS EXPERIMENTAL. IT IS NOT MEANT FOR ANY PRODUCTION USE AND A LOT OF BUGS ARE TO BE EXPECTED.

Currently, this image has only been tested using XQuartz (X11) on a macOS host. It should work with any X server, but some extra tweaking might be required.

On macOS, install XQuartz from either homebrew or the official website here: https://www.xquartz.org⁠. For the initial setup, we are going to automate as much as possible to avoid repeating steps. If you don't want to do this, you will need to enter these commands each time you restart X11, using a terminal. Open a terminal and execute:

nano ~/.xinitrc

Then insert these 3 lines:

export DISPLAY=:0
xhost +localhost
quartz-wm

Next up, open the XQuartz app. As part of the initial setup, go to XQuartz (upper-left corner) > Settings > Security and check both allow connections and allow network clients (this is mandatory).

eSAFETY NOTICE: X11 operates on port 6000. There is a danger if you change the second line in the ~/.xinitrc file to

xhost +

You can set any host, but not setting any will allow connections from everywhere. If you publicly open port 6000 to your machine, any container running on the Internet knowing your public IP address or associated domains will be able to push GUI content straight to your machine. It is recommended to keep localhost as the only allowed host, unless you really know what you are doing and getting yourself into.

To save the configuration, this is important: reboot your computer entirely (no logout, a real system reboot is required).

You are now ready to use the image in a container!

First, open the XQuartz app. You will need to keep it open every time you need the container. Once XQuartz is ready, open a terminal and type in:

docker run -it --rm --env="DISPLAY=host.docker.internal:0.0" -p 2222:22 plugndock/ubuntu-x

NOTE: On Docker for Linux, you need to add an extra parameter to allow host.docker.internal to be operational:

--add-host host.docker.internal:host-gateway

If everything worked smoothly, you should see two terminal windows pointing to your newly created container: the default from your system and XTERM running in X11. Note that you can at any time launch other XTERM terminals by simply typing in the classic terminal:

xterm &

If you need to launch any GUI application, always prefer to use an XTERM window. From there, everything is already set! Try launching firefox by typing in the XTERM window:

firefox &

The & sign will put the program in the background and free the XTERM window for other commands. If you want to debug a program or interact with it in a console, you can always run it without the & sign.

You might wonder what the 2222 port we mapped to the SSH port of the docker container is used for. As long as you stay in XTERM, you don't actually need it. But wouldn't it be cool to open a window (let's say Libre Office for example) from your host directly? Without ever needing to use the XTERM window? Well, you can! Simply install the Xpra client (available here: https://github.com/Xpra-org/xpra/wiki/Download⁠), and run this command

xpra start ssh://root@localhost:2222/ --start=libreoffice

(or any other GUI program!)

If you only want to use the Xpra client, you don't even need to install or setup the X11 server in the first place. The container is shipped with all the tools ready, up and running.

If you want to stop the container and all of its programs, just type in the classic terminal:

exit

You are free to go further and setup volumes, make additional installations, etc... But always remember, containers were never designed to replace a VM in terms of usage!

Tag summary

Content type

Image

Digest

sha256:a9f9e3b3b…

Size

3.1 GB

Last updated

almost 4 years ago

docker pull plugndock/ubuntu-x