我创建了一个Dockerfile,该文件创建虚拟环境,安装所有库并激活该虚拟环境以供进一步使用。
dockerfile:
FROM debian:9.4-slim
##################################################
# Install Anaconda 3:
##################################################
RUN apt-get update && apt-get install -y \
--fix-missing \
build-essential \
cmake \
gfortran \
git \
wget \
curl \
graphicsmagick \
libgraphicsmagick1-dev \
libatlas-dev \
libavcodec-dev \
libavformat-dev \
libgtk2.0-dev \
libjpeg-dev \
liblapack-dev \
libswscale-dev \
pkg-config \
python3-dev \
python3-numpy \
software-properties-common \
zip \
&& apt-get clean && rm -rf /tmp/* /var/tmp/* \
&& curl -o miniconda_install.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& bash miniconda_install.sh -b -p ~/anaconda3 \
&& echo 'export PATH="~/anaconda3/bin:$PATH"' >> ~/.bashrc \
&& ~/anaconda3/bin/conda update -n base conda \
&& rm miniconda_install.sh \
&& rm -rf /var/lib/apt/lists/* \
&& /bin/bash -c "source ~/.bashrc"
ENV PATH="~/anaconda3/bin:${PATH}"
##################################################
# Setup env for current project:
##################################################
EXPOSE 1487 1488
RUN /bin/bash -c "conda create -y -n voice"
ADD erjan_environment_var_for_voice.txt /tmp/setup/requirements.txt
RUN /bin/bash -c "source activate voice"
RUN /bin/bash -c "pip install -r /tmp/setup/requirements.txt"
WORKDIR /Service
ADD Service /Service
ENTRYPOINT ["/bin/bash", "-c", "source activate voice && ./run.sh"]
运行此命令时:
sudo docker build . -t jysan_bank:dev
错误:
ERROR: Command errored out with exit status 1:
command: /root/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-1mbm1qnz/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-1mbm1qnz/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-req-build-1mbm1qnz/pip-egg-info
cwd: /tmp/pip-req-build-1mbm1qnz/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/root/anaconda3/lib/python3.7/tokenize.py", line 447, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-req-build-1mbm1qnz/setup.py'
我从类似的项目中获得了这个dockerfile,它运行正常。我更改了requirements.txt文件,使其包含我需要的库。
为什么不起作用并要求一些文件tmp / pip-req?