Zypper install fails when building an image based on OpenSuse with Docker for Windows

I have a strange issue with Docker on Windows 10 (WSL 2).

When I build an image based on OpenSuse 15.xx, sometimes the command zypper -n install some-package fails with code 106. The problem is gone after the machine reboot. But, after some repeats, it appears again.

I tried to reproduce the issue with Docker Engine + Ubuntu host OS. But, it works fine in this case.

Did anyone face with such strange behavior?

Here is a part of my Dockerfile and the error message:

FROM opensuse/leap AS base
RUN zypper clean --all
RUN zypper -n install wget libicu && \
    wget https://packages.microsoft.com/keys/microsoft.asc
RUN rpm --import microsoft.asc

RUN wget https://packages.microsoft.com/config/opensuse/15/prod.repo && \
    mv prod.repo /etc/zypp/repos.d/microsoft-prod.repo && \
    chown root:root /etc/zypp/repos.d/microsoft-prod.repo
RUN zypper -n install aspnetcore-runtime-7.0

#Install dependencies
RUN zypper -n install glibc-devel fontconfig

#Install fonts
RUN zypper -n install fetchmsttfonts


executor failed running [/bin/sh -c zypper -n install wget libicu &&     wget https://packages.microsoft.com/keys/microsoft.asc &&     rpm --import microsoft.asc]: exit code: 106

It is only a guess, but sometimes a repository has multiple ip addresses behind one domain name and some ip addresses don’t work or you get ipv6 address from the name server, but ipv6 is not supported on your machine or in a container and it couldn’t be detected for some reason. I had a similar problem with ubuntu repositories so this is just an idea to investigate. Look fo the host name of the repository and use nslookup to get the ip addresses in the container. If opensuse container doesn’t have nslookup by default, just run any container that has. I like to use nicolaka/netshoot it has everything and more :slight_smile: IF you have the ip addresses you can try to send request to those ip addresses for example by using curl which can define the host header:

curl -L -H 'Host: hostname.tld' http://IPADDRESS

About solutions: I had to disable ipv6 completely on my machine to make APT package manager work again.

1 Like