Docker build 安装报错, Could not open requirments file: [Errno 2] No such file or directory:'requirements.txt'

docker安装教程
https://docs.docker.com/get-started/part2/#build-the-app

相关帖子
https://stackoverflow.com/questions/32207202/multiple-django-requirements-with-docker

dockerfile

# Use an official Python runtime as a parent image
FROM python:2.7-slim

# Set the working directory to /app
WORKDIR /appl

# Copy the current directory contents into the container at /app
ADD . /app

# Install any needed packages specified in requirements.txt
RUN pip install -r requirements.txt

# Make port 80 available to the world outside this container
EXPOSE 80

# Define environment variable
ENV NAME World

# Run app.py when the container launches
CMD ["python", "app.py"]

在使用

docker build -t friendly2 .

指令安装时,出现警告

Could not open requirements fils: [Errno 2] No such file or directory: 'requirments.txt'
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code:1

解决方法,修改dockerfile,增加语句:

COPY requirements.txt requirements.txt

posted on 2017-09-16 15:42  lion_zheng  阅读(2896)  评论(0编辑  收藏  举报

导航