Docker 错误:错误检查上下文:'can't stat '/home/xyz/docker_experiments''
Docker Errors : error checking context: 'can't stat '/home/xyz/docker_experiments''
我是 运行 docker [Docker 版本 17.06.2-ce,在 Ubuntu 机器上构建 a04f55b]。
简单地执行 docker 中的一个非常简单的练习以构建 docker 图像:https://docs.docker.com/get-started/part2/#apppy
在 运行 上执行以下命令
sudo docker build -t friendlyhello .
我收到以下错误
error checking context: 'can't stat '/home/xyz/docker_experiments''.
我知道这与装备和权限有关。
根据要求,这是 Docker文件
# Use an official Python runtime as a parent image
FROM python:2.7-slim
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -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"]
可能是权限问题。
2 件事你可以尝试:
- 尝试删除 sudo。如果你在安装时正确配置了Docker,你就不需要在每个命令上都使用sudo。如果我开始工作后你 运行 遇到了这个麻烦,我可以用代码更新这个答案。
- 尝试将您的 dockerfile 从 ubuntu 目录移到您已设置并有权访问的目录中。尝试更改该目录,以便您拥有所需的所有访问权限。
mkdir /docker/test
cp . /docker/test
cd /docker/test
sudo docker build -t friendlyhello .
我是 运行 docker [Docker 版本 17.06.2-ce,在 Ubuntu 机器上构建 a04f55b]。
简单地执行 docker 中的一个非常简单的练习以构建 docker 图像:https://docs.docker.com/get-started/part2/#apppy
在 运行 上执行以下命令
sudo docker build -t friendlyhello .
我收到以下错误
error checking context: 'can't stat '/home/xyz/docker_experiments''.
我知道这与装备和权限有关。
根据要求,这是 Docker文件
# Use an official Python runtime as a parent image
FROM python:2.7-slim
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -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"]
可能是权限问题。
2 件事你可以尝试:
- 尝试删除 sudo。如果你在安装时正确配置了Docker,你就不需要在每个命令上都使用sudo。如果我开始工作后你 运行 遇到了这个麻烦,我可以用代码更新这个答案。
- 尝试将您的 dockerfile 从 ubuntu 目录移到您已设置并有权访问的目录中。尝试更改该目录,以便您拥有所需的所有访问权限。
mkdir /docker/test
cp . /docker/test
cd /docker/test
sudo docker build -t friendlyhello .