Start lubuntu Desktop in Docker
During my summer holidays, I've watched this video: Full Ubuntu GUI in a Container Displayed on Windows (XServer) and, of course, I wanted to play with it.
The idea is to start a Lubuntu Desktop distribution as a Docker container. Lubuntu is a lightweight Ubuntu distribution designed to be more resource-efficient than the standard Ubuntu.
Using Docker and Windows X Server, we'll be able to play with Lubuntu just like any other containers i.e. play and drop without any impact on our ghost. Ideal for learning purposes then.
I encourage you to watch the video Full Ubuntu GUI in a Container Displayed on Windows (XServer).
Step 1 - Create the Dockerfileβ
There is just one file to create called Dockerfile
and with this content:
FROM ubuntu:latest
RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y lubuntu-desktop lightdm
RUN rm -f /run/reboot-required*
RUN echo "/usr/sbin/lightdm" > /etc/X11/default-display-manager
RUN echo "\
[LightDM]\n\
[Seat:*]\n\
type=xremote\n\
xserver-hostname=host.docker.internal\n\
xserver-display-number=0\n\
autologin-user=root\n\
autologin-user-timeout=0\n\
autologin-session=Lubuntu\n\
" > /etc/lightdm/lightdm.conf.d/lightdm.conf
ENV DISPLAY=host.docker.internal:0.0
CMD service dbus start ; service lightdm start
Build the image by running docker build --tag cavo789/lubuntu .
(think to replace cavo789
with your pseudo).