我今天刚刚下载了Windows 10 64位的Docker工具箱。我正在看教程。当我试图使用Dockerfile构建一个映像时,我收到以下错误。

步骤:

启动Docker快速入门终端。 Testdocker创建后。 准备Dockerfile文档在“建立你自己的形象”网页链接 运行以下命令

Docker build -t Docker -whale。

错误:$ docker build -t docker-whale。

unable to prepare context: unable to evaluate symlinks in Dockerfile path: GetFileAttributesEx C:\Users\Villanueva\Test\testdocker\Dockerfile:系统找不到指定的文件。

顺便说一句:我尝试了提到的几个选项@ https://github.com/docker/docker/issues/14339

docker info

输出:

Containers: 4
 Running: 0
 Paused: 0
 Stopped: 4
Images: 2
Server Version: 1.10.1
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 20
 Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Plugins:
 Volume: local
 Network: bridge null host
Kernel Version: 4.1.17-boot2docker
Operating System: Boot2Docker 1.10.1 (TCL 6.4.1); master : b03e158 - Thu Feb 11 22:34:01 UTC 2016
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 996.2 MiB
Name: default
ID: C7DS:CIAJ:FTSN:PCGD:ZW25:MQNG:H3HK:KRJL:G6FC:VPRW:SEWW:KP7B
Debug mode (server): true
 File Descriptors: 32
 Goroutines: 44
 System Time: 2016-02-19T17:37:37.706076803Z
 EventsListeners: 0
 Init SHA1:
 Init Path: /usr/local/bin/docker
 Docker Root Dir: /mnt/sda1/var/lib/docker
Labels:
 provider=virtualbox

当前回答

确保文件名“Dockerfile”没有任何扩展名。 只需创建一个没有任何扩展名的文件。

并确保Dockerfile位于您试图构建Docker映像的同一目录中。

其他回答

这只是因为记事本在Dockerfile末尾添加了“。txt”。

我用Visual Studio 2017 Docker支持工具创建了DockerFile,也出现了同样的错误。

过了一会儿,我意识到我不在包含Dockerfile的正确目录(~\source\repos\DockerWebApplication\)。我cd到项目内部的正确文件(~/source/repos/DockerWebApplication/DockerWebApplication),并成功创建了Docker映像。

确保您移动到Dockerfile所在的目录。 确保Dockerfile是无扩展名的。也就是说,不是Dockerfile.txt、Dockerfile.rtf或任何其他文件。 确保你命名为Dockerfile,而不是Dockerfile, Dockerfile或任何其他。

在Linux中,文件夹是区分大小写的。

我得到这个错误是因为文件夹名为TestAPI,而我正在使用TestAPI。

安装码头工人。IO代替docker帮助了我

i.e.

apt install docker.io