Docker build fails after os Upgrade

Viewed 45

I had been succussfully running and updating Redmine / Nginx on a local Ubuntu Server 22.4. I recently upgraded the OS and then tried to upgrade to the latest version of redmine.

My Dockerfile basically gets the latest Redmine container then copies in a couple extensions.

FROM redmine:latest
COPY --chown=redmine:redmine ./auth_source_ldap.rb ./app/models/
ADD --chown=redmine:redmine ./redmine_dmsf ./plugins/redmine_dmsf
ADD --chown=redmine:redmine ./redmine_more_previews ./plugins/redmine_more_previews
RUN apt-get install -y xapian-omega ruby-xapian libxapian-dev xpdf poppler-utils antiword unzip catdoc libwpd-tools \
libwps-tools gzip unrtf catdvi djview djview3 uuid uuid-dev xz-utils libemail-outlook-message-perl nano pandoc

At the end of the the docker build I get a failure when the customized image is being created:

Step 6/6 : RUN apt-get install -y xapian-omega ruby-xapian libxapian-dev xpdf poppler-utils antiword unzip catdoc libwpd-tools libwps-tools gzip unrtf catdvidjview djview3 uuid uuid-dev xz-utils libemail-outlook-message-perl nano pandoc
 ---> Running in b1464eeddd71
failed to create endpoint laughing_ritchie on network bridge: adding interface veth9feff58 to bridge docker0 failed: could not find bridge docker0: route ip+net: no such network interface

The custom image does not get created.

doing a docker image ls returns

REPOSITORY   TAG       IMAGE ID       CREATED          SIZE
<none>       <none>    1b8dcc50a795   29 minutes ago   616MB
redmine      latest    bf1de550a9ed   2 weeks ago      595MB

based on a suggestion in an old post I tried isolating the creation of the endpoint by running the following:

brctl addif veth9feff58 docker0

which just returns:

interface docker0 does not exist!

My current assumption is that during the upgrade some system file that defines "docker0" got overwritten but I can't tell which one.

I have tried uninstalling and reinstalling Docker but the results are the same.

Also, old containers will no longer start.

========== Edit / Additional Information =================

After reinstalling hello-world ran successfully once but then when I tried to build again it had the same problem. My docker service now looks like this:

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket firewalld.service containerd.service
Wants=network-online.target
Requires=docker.socket containerd.service

[Service]
Type=notify

ExecStartPre=-/usr/bin/ip link set dev docker0 down
ExecStartPre=-/usr/sbin/brctl delbr docker0
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

StartLimitBurst=3

StartLimitInterval=60s

LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity

TasksMax=infinity

docker containers
Delegate=yes

KillMode=process
OOMScoreAdjust=-500

[Install]
WantedBy=multi-user.target
2 Answers

Would you please Show us how does this file look a like:

/usr/lib/systemd/system/docker.service

Normally it has to look like that:

[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target
Wants=docker-storage-setup.service

[Service]
Type=notify
EnvironmentFile=-/etc/default/docker
ExecStartPre=-/usr/bin/ip link set dev docker0 down
ExecStartPre=-/usr/sbin/brctl delbr docker0
Environment=GOTRACEBACK=crash
ExecStart=/usr/bin/docker daemon \
          $OPTIONS \
          $DOCKER_STORAGE_OPTIONS \
          $DOCKER_NETWORK_OPTIONS \
          $INSECURE_REGISTRY
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
MountFlags=slave
TimeoutStartSec=1min

[Install]
WantedBy=multi-user.target

Please verify this 2 lines:

ExecStartPre=-/usr/bin/ip link set dev docker0 down

ExecStartPre=-/usr/sbin/brctl delbr docker0

if not please try to change the different lines from your side then;

systemctl daemon-reload && systemctl restart docker

wish that could help you and hope you notify me if its good to go

While I am not sure of the root cause, it appears that some updated package caused a conflict. (Recall I had just upgraded Ubuntu 22.04 LTS)

I found steps to re-install most of my packages and the problem cleared up. I am not guru and some of these steps may not be relevant. If I had time it would have been nice to reboot and test after various steps...

If it is helpful to anyone else these are the steps I used clean up my system packages:

rm /var/lib/apt/lists/lock
rm /var/lib/dpkg/lock
rm /var/lib/dpkg/lock-front-end
rm /var/cache/apt/archives/lock
dpkg --configure -a
apt clean
apt update --fix-missing
apt install -f
dpkg --configure -a
apt upgrade
apt dist-upgrade

and then rebooted

After that everything is back up and running.

Related