I am using docker tutorial (https://docs.docker.com/language/python/build-images/) to build a simple python app. Using freeze
command I made requirements.txt
file which consists a lot of packages.
When I want to build the docker image, I am getting this error:
Step 4/6 : RUN pip3 install -r requirements.txt ---> Running in
f92acd21d271
ERROR: Could not find a version that satisfies the requirement
apt-clone==0.2.1 (from versions: none)
ERROR: No matching distribution found for apt-clone==0.2.1
The command '/bin/sh -c pip3 install -r requirements.txt' returned a
non-zero code: 1
This is my dockerfile contents (same as what is mentioned in the tutorial):
# syntax=docker/dockerfile:1
FROM python:3.8-slim-buster
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
COPY . .
CMD [ "python3", "-m", "flask","run","--host=0.0.0.0" ]
It's not related to apt-clone==0.2.1 package. Whatever I try to install in the docker image, it fails. I tried apt update and installing pip3 in the dockerfile too but didn't work.
What did I miss?
pip3 freeze
outputs the package and its version installed in the current environment, no matter the package installed by pip
or with other methods.
In fact, apt-clone==0.2.1
comes from debian package repo, not from pypi.org
, see next:
$ pip3 freeze | grep apt-clone
$ apt-get install -y apt-clone
$ dpkg -l apt-clone
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii apt-clone 0.4.1 all Script to create state bundles
$ dpkg -L apt-clone
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/apt-clone
/usr/share/doc/apt-clone/copyright
/usr/share/doc/apt-clone/changelog.gz
/usr/share/man
/usr/share/man/man8
/usr/share/man/man8/apt-clone.8.gz
/usr/lib
/usr/lib/python3
/usr/lib/python3/dist-packages
/usr/lib/python3/dist-packages/apt_clone.py
/usr/lib/python3/dist-packages/apt_clone-0.2.1.egg-info
/usr/bin
/usr/bin/apt-clone
$ pip3 freeze | grep apt-clone
apt-clone==0.2.1
You could see from above, the apt_clone.py
& apt_clone-0.2.1.egg-info
are installed by debian package apt-clone
, the 0.4.1
is just the debian package version, while 0.2.1
is the python package version.
So, for apt-clone
similar, you need to install them with apt
although they are seen in pip3 freeze
.