我对 Docker 完全陌生,我正在尝试使用 DockerFile 中定义的指令创建和运行一个非常简单的示例。
DockerFile->
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y python3 pip
COPY ./ .
RUN python3 test.py
test.py 的内容 ->
import pandas as pd
import numpy as np
print('test code')
用于创建 Docker 容器的命令 ->
docker build --no-cache . -t intro_to_docker -f abs/path/to/DockerFile
文件夹结构 -> (两个文件都存在于 abs/path/to)
abs/path/to:
-DockerFile
-test.py
错误信息->
来自发件人的错误:打开 .Trash:不允许操作
(使用 sudo su 没有解决问题,我认为这与复制命令有关)
我使用的是 Mac。
任何解决此问题的帮助将不胜感激!
最佳答案
Dockerfile 应该在一个文件夹中。导航到该文件夹,然后运行 docker build 命令。我也面临同样的问题,但是在将 docker 文件移动到文件夹中时得到了解决
关于python - 尝试使用 DockerFile 创建 Docker 容器时遇到以下错误 -> "error from sender: open .Trash: operation not permitted",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69864951/