I am trying to emulate what x11docker does without using x11docker, and there are helpful samples to do that for Wayland and X.
I had this sample working in Ubuntu 18.04:
Dockerfile
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y chromium-browser
CMD ["/usr/bin/chromium-browser", "--no-sandbox", "--start-fullscreen", "https://duckduckgo.com"]
docker-compose.x11.yml
version: "3"
services:
app:
build:
context: .
network: host
environment:
- DISPLAY=${DISPLAY}
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
I then just ran
docker-compose up --build
and I got a chromium browser pointed to duckduckgo.
However, I have now updated to 20.04 and I can't get this to work any longer with either of the samples.
The sample above generates the following error:
$ docker-compose -f docker-compose.x11.yml up --build
Building app
Sending build context to Docker daemon 5.12kB
Step 1/3 : FROM ubuntu:18.04
---> 81bcf752ac3d
Step 2/3 : RUN apt-get update && apt-get install -y chromium-browser
---> Using cache
---> 2d81deee9198
Step 3/3 : CMD ["/usr/bin/chromium-browser", "--no-sandbox", "--start-fullscreen", "https://duckduckgo.com"]
---> Using cache
---> 50d1aa785f78
Successfully built 50d1aa785f78
Successfully tagged asdf_app:latest
Starting asdf_app_1 ... done
Attaching to asdf_app_1
app_1 | No protocol specified
app_1 | [1:1:0709/125654.379970:ERROR:browser_main_loop.cc(1402)] Unable to open X display.
asdf_app_1 exited with code 1
So I created an adapted Wayland compose since I understood that is t he default in 20.
docker-compose.wayland.yml
version: "3"
services:
app:
build:
context: .
network: host
environment:
- WAYLAND_DISPLAY=${WAYLAND_DISPLAY}
- DISPLAY=${DISPLAY}
volumes:
- ${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}:/tmp/${WAYLAND_DISPLAY}
- /tmp/.X11-unix:/tmp/.X11-unix
This generates the same error ("Unable to open X display"). My host system does not have any value for WAYLAND_DISPLAY, but does have a value for XDG_RUNTIME_DIR. XDG_SESSION_TYPE has a value of x11. DISPLAY is set to :0.
So what am I actually running here, and how do I find out? Based on what I've found, it seems like I'm running Wayland:
$ cat /etc/gdm3/custom.conf
# GDM configuration storage
#
# See /usr/share/gdm/gdm.schemas for a list of available options.
[daemon]
AutomaticLoginEnable=true
AutomaticLogin=johan
# Uncomment the line below to force the login screen to use Xorg
#WaylandEnable=false
# Enabling automatic login
# Enabling timed login
# TimedLoginEnable = true
# TimedLogin = user1
# TimedLoginDelay = 10
[security]
[xdmcp]
[chooser]
[debug]
# Uncomment the line below to turn on debugging
# More verbose logs
# Additionally lets the X server dump core if it crashes
#Enable=true
So why is XDG_SESSION_TYPE saying x11?
What combination of values do I need to allow me to share my screen with a Docker container?