Skip to content

Commit f390189

Browse files
committed
contrib: dockerfile: Update to bookworm and drop libvirt compatibility
The current container is running debian bullseye and is starting systemd to run libvirtd in background. This container is broken since some times. This commit updates the dockerfile to run interactively, libvirt isn't supported in this version. There are two launch options, start to run in production which will use the packaged version of Elbe and start-devel which will use the version of Elbe currently being used by the repository. Signed-off-by: Thomas Bonnefille <[email protected]>
1 parent 69972fd commit f390189

File tree

3 files changed

+32
-26
lines changed

3 files changed

+32
-26
lines changed

contrib/dockerfile/Dockerfile.in

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@
44
# SPDX-FileCopyrightText: 2018 Linutronix GmbH
55

66
# This Dockerfile generate a image for the elbe buildsystem
7-
FROM debian:bullseye
7+
FROM debian:bookworm-slim
88

99
USER root
1010
ENV DEBIAN_FRONTEND noninteractive
1111

1212
# use a sources.list including backports and security
13-
RUN echo "deb http://deb.debian.org/debian bullseye-backports main" >> /etc/apt/sources.list; \
14-
echo "deb http://deb.debian.org/debian-security bullseye-security main" >> /etc/apt/sources.list
13+
RUN echo "deb http://deb.debian.org/debian bookworm-backports main" >> /etc/apt/sources.list; \
14+
echo "deb http://deb.debian.org/debian-security bookworm-security main" >> /etc/apt/sources.list
1515

1616
# update, upgrade and install elbe runtime-dependencies
1717
RUN apt-get update -y ;\
1818
apt-get install -y --no-install-recommends \
1919
-o Dpkg::Options::="--force-confnew" \
20-
systemd \
2120
ca-certificates \
2221
sudo \
2322
vim-nox \
@@ -61,27 +60,13 @@ RUN useradd -d /home/elbe -l -U -G kvm-elbe,libvirt -m -s /bin/bash -u @USERID@
6160
RUN echo "root:elbe" | chpasswd
6261
RUN echo "elbe:elbe" | chpasswd
6362

64-
RUN rm -f /lib/systemd/system/multi-user.target.wants/*;\
65-
rm -f /etc/systemd/system/*.wants/*;\
66-
rm -f /lib/systemd/system/local-fs.target.wants/*; \
67-
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
68-
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
69-
rm -f /lib/systemd/system/basic.target.wants/*;\
70-
rm -f /lib/systemd/system/anaconda.target.wants/*;
71-
7263
VOLUME [ "/sys/fs/cgroup" ]
73-
VOLUME [ "/elbe" ]
64+
VOLUME [ "/usr/elbe" ]
7465
VOLUME [ "/var/cache/elbe" ]
7566

7667
# sudo for elbe
7768
RUN echo "%elbe ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/elbegrp
7869
RUN chmod 0440 /etc/sudoers.d/elbegrp
7970

80-
# run qemu as root
81-
RUN echo 'user = "root"' >> /etc/libvirt/qemu.conf
82-
RUN echo 'group = "root"' >> /etc/libvirt/qemu.conf
83-
84-
# run libvirt in systemd on startup
85-
RUN systemctl enable libvirtd
8671

87-
CMD [ "/lib/systemd/systemd" ]
72+
CMD [ "/bin/bash" ]

contrib/dockerfile/Makefile

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,41 @@ build:
2323
-t $(IMAGENAME) .
2424
rm Dockerfile
2525

26+
start-devel:
27+
docker ps | grep $(CONTAINERNAME)$$ || \
28+
docker run --name $(CONTAINERNAME) \
29+
-e container=docker \
30+
-e http_proxy=$(http_proxy) \
31+
-e https_proxy=$(https_proxy) \
32+
-e no_proxy=$(no_proxy) \
33+
-v $(shell git rev-parse --show-toplevel):/usr/elbe -w /usr/elbe\
34+
--cap-add SYS_ADMIN \
35+
--security-opt seccomp:unconfined \
36+
--security-opt apparmor:unconfined \
37+
--group-add kvm \
38+
--device /dev/kvm \
39+
--device /dev/fuse \
40+
--rm \
41+
--interactive \
42+
--tty \
43+
$(IMAGENAME)
44+
2645
start:
2746
docker ps | grep $(CONTAINERNAME)$$ || \
28-
docker run --name $(CONTAINERNAME) -d \
47+
docker run --name $(CONTAINERNAME) \
2948
-e container=docker \
3049
-e http_proxy=$(http_proxy) \
3150
-e https_proxy=$(https_proxy) \
3251
-e no_proxy=$(no_proxy) \
33-
-v $(realpath ../../.):/elbe -w /elbe\
34-
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
3552
--cap-add SYS_ADMIN \
3653
--security-opt seccomp:unconfined \
3754
--security-opt apparmor:unconfined \
3855
--group-add kvm \
3956
--device /dev/kvm \
4057
--device /dev/fuse \
58+
--rm \
59+
--interactive \
60+
--tty \
4161
$(IMAGENAME)
4262

4363
stop:

contrib/dockerfile/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ You need docker installed, a running docker service and `make` installed.
2727
## usage
2828

2929
A `Makefile` with some handy targets are provided. Per default the image name
30-
is `elbe-image` and a started container name is `elbe`. This names are
30+
is `elbe-devel-image` and a started container name is `elbe-devel`. This names are
3131
changeable via `IMAGENAME` and `CONTAINERNAME` environment variables.
3232

3333
* `build`: build the image
34-
* `start` start a container, mounts the elbe git-archive to `/elbe`
34+
* `start` start a container, and use packaged
35+
* `start-devel` start a container, mounts the elbe git-archive to `/usr/elbe`
3536
* `stop`: stop a running container
3637
* `stoprm`: stop and remove the container
37-
* `connect`: attach to a running container
38+
* `connect`: attach a new terminal to a running container
3839

3940
After `connect` you can find the elbe git repository under `/elbe`.
4041

0 commit comments

Comments
 (0)