我有一个Docker合成文件,它用GitHub URL为上下文设置了一个服务。服务的Dockerfile复制了一个requirements.txt
并安装了它。这可以正常工作(COPY requirements.txt /rasa_traind/
)。但是当我把该行改为COPY . <dir>
时,我得到了一个COPY failed: file not found in build context
错误。
Docker撰写
chatbot_server:
build:
context: <GitHub URL>
dockerfile: Dockerfile
ports:
- "5005:5005"
depends_on:
- rasa_actions_server
- redis
extra_hosts:
- "host.docker.internal:host-gateway" # for docker.host.internal to work on Linux
码头组合建筑
Step 4/8 : RUN pip install --upgrade pip
---> Using cache
---> 5a584d36ea77
Step 5/8 : COPY . /rasa_traind/
ERROR: Service 'chatbot_server' failed to build: COPY failed: file not found in build context or excluded by .dockerignore: stat rasa_traind/: file does not exist
停靠文件
FROM python:3.8.12-slim-buster
RUN apt-get update
RUN yes | apt-get install python3-dev build-essential
RUN pip install --upgrade pip
# COPY requirements.txt /rasa_traind/ # Works
COPY . /rasa_traind/
RUN pip install -r requirements.txt
WORKDIR /rasa_traind/rasa_actions_server/
CMD ["rasa", "run"]
1条答案
按热度按时间fhity93d1#
您是否尝试过在COPY . /Rasa_traind/之前设置WORKDIR。类似于以下内容