我是Docker的新手,尝试构建停靠的应用程序时遇到错误。我有一个要与docker包装在一起的python脚本。我的requirements.txt文件开始如下:
alabaster==0.7.12
anaconda-client==1.7.2
anaconda-navigator==1.9.7
anaconda-project==0.8.3
asn1crypto==1.2.0
astroid==2.3.2
astropy==3.2.2
atomicwrites==1.3.0
attrs==19.3.0
...
我的Dockerfile是:
FROM python:alpine3.7
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
EXPOSE 5000
CMD python ./python_script.py
在运行docker build --tag python_app .
时,我得到以下输出:
Sending build context to Docker daemon 1.097GB
Step 1/6 : FROM python:alpine3.7
---> 00be2573e9f7
Step 2/6 : COPY . /app
---> 6f46c90dbc6f
Step 3/6 : WORKDIR /app
---> Running in 9458595eba85
Removing intermediate container 9458595eba85
---> 0f1fb57bba19
Step 4/6 : RUN pip install -r requirements.txt
---> Running in 8eb7b6f86dff
Collecting alabaster==0.7.12 (from -r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/10/ad/00b090d23a222943eb0eda509720a404f531a439e803f6538f35136cae9e/alabaster-0.7.12-py2.py3-none-any.whl
Collecting anaconda-client==1.7.2 (from -r requirements.txt (line 2))
Could not find a version that satisfies the requirement anaconda-client==1.7.2 (from -r requirements.txt (line 2)) (from versions: 1.1.1,1.2.2)
No matching distribution found for anaconda-client==1.7.2 (from -r requirements.txt (line 2))
You are using pip version 19.0.1,however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
我可以只从requirements.txt中删除anaconda-client吗?我只是使用pip Frozen构建了文件,尽管为了简单起见,我想保留整个列表,但不要直接将其导入代码中。