我正在建立一个网站,我使用 Django 和 Gunicorn 设置了后端,并且我试图将整个东西打包在一个 docker 容器中。我17.05.0-ce
在 Ubuntu 17.04 Zesty 上使用 docker edge。出于某种原因,即使目录mysite
中有Dockerfile
Django 应用程序 , requirements.txt
(start.sh
在github 上),docker 构建也会停止在ADD requirements.txt /app/src/requirements.txt
.
# Dockerfile
# FROM base image to build upon
FROM phusion/baseimage
# RUN install python and pip
RUN apt-get update
RUN apt-get install -y python python-pip python-dev
# ADD requirements.txt and RUN pip to install them
ADD requirements.txt /app/src/requirements.txt
WORKDIR /app/src
RUN pip install -r requirements.txt
# EXPOSE port 8000 to allow communication to/from server
EXPOSE 8000
# CMD execute start.sh to start the server running.
WORKDIR /app/src/mysite
CMD ["/start.sh"]
# done!
我导航到“mysite”,运行docker build - < Dockerfile
它并在它复制的行上停止,requirements.txt
我收到以下错误:
Sending build context to Docker daemon 2.048kB
Step 1/9 : FROM phusion/baseimage
---> 877509368a8d
Step 2/9 : RUN apt-get update
---> Using cache
---> adcb4b9e8b08
Step 3/9 : RUN apt-get install -y python python-pip python-dev
---> Using cache
---> 8dbbd3e010d5
Step 4/9 : ADD requirements.txt /app/src/requirements.txt
lstat requirements.txt: no such file or directory
对我来说,这说明我做错了。