我今天刚刚下载了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

当前回答

我的案例(从Windows 10运行):

将文件重命名为myDockerFile。Dockerfile到Dockerfile(不带扩展名)。

然后在文件夹外运行这个命令:

docker build .\Docker-LocalNifi\

这对我和我的同事都适用。

其他回答

请检查Docker是否在您的Windows安装上运行。我试图找到解决方案,然后意外地检查并发现了问题。

确保你的DOCKERfile在应用程序目录的根目录下,我把我的文件放在src中,这导致了这个错误,因为Docker没有找到DOCKERfile的路径

要构建Dockerfile,请将自动化的内容保存在Dockerfile中。不是Dockerfile,因为在打开文件命令时:

notepad Dockerfile

(由于写入了文本文件,因此无法构建该文件。)

要构建文件,运行:

notepad Dockerfile

现在运行:

docker build -t docker-whale .

确保您在Dockerfile的当前目录中。

如果你在Windows 8上工作,你将使用Docker工具箱。

在mydockerbuild目录下,运行以下命令,因为你的Dockerfile是一个文本文件:

docker build -t docker-whale -f ./Dockerfile.txt .

此问题与DockerFile创建过程有关。

为了工作,打开cmd, cd到感兴趣的目录,输入:

abc>DockerFile

这将在您的文件夹中创建一个名为DockerFile的文件。

现在类型:

notepad DockerFile

这将在记事本中打开DockerFile文件,你必须复制/粘贴提供的标准代码。

保存文件,现在,最后,用Docker输入构建您的映像:

docker build -t docker-whale .

这对我很有用。