Build a full Ubuntu desktop docker image

2019-07-12 13:35发布

问题:

I want to build a full version of Ubuntu 14 desktop as the base image for gui applications, I know how to build on the Ubuntu desktop version by the debootstrap, as described in https://docs.docker.com/articles/baseimages/, but that is a minimal Linux version and some GUI application cannot run perfectly, because there are some basic components missing, such as a font family, so I want the full control of a basic image, thanks!

回答1:

I don't see the benefits of it, but impossible n'est pas français (impossible isn't French).

Docker Desktop is a way that will give you an X11 server to connect on using SSH.

This Dockerfile creates a docker image and once it's executed it creates a container that runs X11 and SSH services. The ssh is used to forward X11 and provide you encrypted data communication between the docker container and your local machine.



回答2:

fcwu/docker-ubuntu-vnc-desktop

https://github.com/fcwu/docker-ubuntu-vnc-desktop provides a convenient setup:

docker run --name ub16vnc -p 6080:80 -p 5900:5900 dorowu/ubuntu-desktop-lxde-vnc

Then either:

  • visit: http://127.0.0.1:6080/#/ which runs a noVNC more limited JavaScript VNC client

  • run:

    sudo apt-get install tigervnc-viewer
    xtigervncviewer :5900
    

    Then inside vinagre, you might want to go into full screen mode to be able to see the full desktop

    I also tried vinagre, but it was much laggier when scrolling Firefox on YouTube.

To quit just kill docker on the terminal. And to restart the machine

docker start ub16vnc

and then reconnect with VNC. Then to quit the machine:

docker stop ub16vnc

You have to wait a few seconds for the VNC server on the guest to start before you can connect.

Chromium won't start from the menu. If you try to launch it from the command line it explains why:

Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

Firefox does not care however.

TODO: no audio. --device /dev/snd did not help:

  • How to play sound in a docker container
  • https://forums.docker.com/t/how-to-get-sound/36527
  • https://github.com/fcwu/docker-ubuntu-vnc-desktop/issues/49

Tested on Ubuntu 18.04 host, fcwu/docker-ubuntu-vnc-desktop 4f187de35bf45ab1997b324039f8e29a0b3e8e57.