andrewmackrodt/dockerfiles

Unable to start chromium-x11 container because snapd is not running

fmichaud opened this issue · 2 comments

Hello @andrewmackrodt !

First, I want to thank you for this impressive work which help me a lot !

I noticed a small bug when starting the container from the chromium-x11 image published on Docker Hub.

Steps to reproduce

My settings

  • Operating system : Debian 11.6
  • Docker version 23.0.1

Step 1 - Creating Chromium container from Docker image

I exactly ran the commands from the project's documentation to create a chromium-x11 container.

fmichaud@m***d:~/Documents/Workspace/tmp/x11$ # detect gpu devices to pass through
GPU_DEVICES=$( \
    echo "$( \
        find /dev -maxdepth 1 -regextype posix-extended -iregex '.+/nvidia([0-9]|ctl)' \
            | grep --color=never '.' \
          || echo '/dev/dri'\
      )" \
      | sed -E "s/^/--device /" \
  )

# get the xdg runtime dir
XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"

# create the container
docker create \
  --name chromium \
  --cap-add SYS_ADMIN \
  --security-opt apparmor:unconfined \
  --net host \
  --device /dev/input \
  --device /dev/snd \
  $GPU_DEVICES \
  -v $HOME/Downloads:/downloads \
  -v $HOME/.config/chromium:/data \
  -e PUID=$(id -u) \
  -e PGID=$(id -g) \
  -e DISPLAY=unix$DISPLAY \
  -e LANG=${LANG:-en_US.UTF-8} \
  -v /tmp/.X11-unix:/tmp/.X11-unix:ro \
  -v /dev/shm:/dev/shm \
  -v $HOME/.config/pulse:/home/ubuntu/.config/pulse:ro \
  -v /etc/machine-id:/etc/machine-id:ro \
  -v $XDG_RUNTIME_DIR/pulse:$XDG_RUNTIME_DIR/pulse:ro \
  -v $XDG_RUNTIME_DIR/bus:$XDG_RUNTIME_DIR/bus:ro \
  -v /var/lib/dbus/machine-id:/var/lib/dbus/machine-id:ro \
  -v /run/dbus:/run/dbus:ro \
  -v /run/udev/data:/run/udev/data:ro \
  -v /etc/localtime:/etc/localtime:ro \
  andrewmackrodt/chromium-x11
8515f7a409c1eea6d586ea88e6ddb1c0083922d11eeea04dc422cb8ba5196d4d

All seems ok :

fmichaud@m***d:~/Documents/Workspace/tmp/x11$ docker ps -a
CONTAINER ID   IMAGE                         COMMAND                  CREATED         STATUS                    PORTS     NAMES
8515f7a409c1   andrewmackrodt/chromium-x11   "/usr/local/bin/dock…"   2 minutes ago   Created                             chromium

As expected the container has no log because it is not started :

fmichaud@mitterrand:~/Documents/Workspace/tmp/x11$ docker logs chromium
fmichaud@mitterrand:~/Documents/Workspace/tmp/x11$ 

Step 2 - Trying to start the container

fmichaud@m**d:~/Documents/Workspace/tmp/x11$ docker start chromium
chromium

The container starts then immediately exits :

fmichaud@m**d:~/Documents/Workspace/tmp/x11$ docker logs chromium

Command '/usr/bin/chromium-browser' requires the chromium snap to be installed.
Please install it with:

snap install chromium

Cause

The snap command of related package manager needs snapd daemon to correctly run. However, the snapd process is not running in the container.

Resolution proposal

I propose to use the apt package manager using the repositories of the underlying debian version provided by ppa:savoury1.

Resources

At your disposal,
Kind regards from Paris 🇫🇷.

Please accept this pull request to fix it : #18