2

What I want to achieve is an OS with GUI inside a docker container, which I can use like a VM and not only via a command line. My host system is a windows 10.

Based on a few other questions here I created a dockerfile with the following content:

FROM ubuntu:latest
RUN apt update
RUN apt install -y x11vnc xvfb firefox
RUN     mkdir ~/.vnc
RUN     x11vnc -storepasswd 1234 ~/.vnc/passwd
CMD /usr/bin/firefox

I create the build and then set the env variable "DISPLAY" to ":0.0". On my host I also installed VcXsrv. On the container I installed "xfce4" and "slim" as manually (since I can't figure out how to inject multiple different answers to the installation prompt).

When starting the container, a Firefox window opens up but when I close it, the container stops.

My questions:

  1. How do I start the container in a way so I see the desktop
  2. How do I close the view on the host without stopping the container
  3. How do I open the view of the container on the host while the container is running?
  4. Can anyone help me out with putting the installation of the GUI inside the dockerfile? I read a few things about "expect" but could not really get it working
DataVader
  • 740
  • 1
  • 5
  • 19
  • Related: https://stackoverflow.com/questions/28212380/why-docker-container-exits-immediately – Caramiriel Oct 17 '18 at 12:37
  • 1
    Jessie Frazelle mentions that she is running GUI apps with docker by mounting the `X11` socket into the container. Read more at her blog post ["Docker Containers on the Desktop"](https://blog.jessfraz.com/post/docker-containers-on-the-desktop/#guis) – tgogos Oct 17 '18 at 12:38
  • 1
    Also related: [Can you run GUI applications in a Docker container?](https://stackoverflow.com/questions/16296753/can-you-run-gui-applications-in-a-docker-container) – tgogos Oct 17 '18 at 12:39
  • thanks @tgogos . It didn't fully solve my problem but a combination of both references achieved most of what I was hoping for. If you post it as an answer, I would mark it as the accepted answer. – DataVader Oct 18 '18 at 13:07

0 Answers0