I am trying to build a Docker image but when I build it, I get the error message : ‘E: Unable to locate package libxcb-util1’.
Here is my Dockerfile :
`# $DEL_BEGIN`
FROM python:3.9.7-buster
WORKDIR /prod
COPY design_interface design_interface
COPY requirements.txt requirements.txt
COPY setup.py setup.py
RUN pip install --upgrade pip
RUN apt-get update && apt install --assume-yes apt-utils
RUN apt-get update && pip install .
RUN apt-get update && pip install opencv-python
RUN apt-get update && apt install --assume-yes libxcb-icccm4
RUN apt-get update && apt install --assume-yes libxcb-image0
RUN apt-get update && apt-get install libxcb-util1
CMD ["python3","design_interface/MainWindow.py"]
`# $DEL_END`
The error message is :
Step 11/12 : RUN apt-get update && apt-get install libxcb-util1
---> Running in a6000629d968
Hit:1 http://deb.debian.org/debian buster InRelease
Hit:2 http://security.debian.org/debian-security buster/updates InRelease
Hit:3 http://deb.debian.org/debian buster-updates InRelease
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package libxcb-util1
The command '/bin/sh -c apt-get update && apt-get install libxcb-util1' returned a non-zero code: 100
What is more difficult to understand is why the command line ‘sudo apt-get update && apt-get install libxcb-util1’ works well on my computer but does not work when building the Docker image with the Dockerfile.
2
Answers
The only solution that I found was to download the file online, and then put it manually in the project repository : design_interface/libxcb-util1_0.4.0-0ubuntu3_amd64.deb.
Then I added in the dockerfile the line : RUN dpkg -i design_interface/libxcb-util1_0.4.0-0ubuntu3_amd64.deb.
It worked. :)
According to https://packages.debian.org/search?keywords=libxcb-util1, the package
libxcb-util1
exists in bullseye, bookworm, and sid. You are apparently using buster. Buster only has libxcb-util0: https://packages.debian.org/search?keywords=libxcb-util0