关于Docker:DockerFile复制/添加文件在生成上下文中失败

Dockerfile COPY / ADD fails for file in build context

dockerfile copy命令失败,尽管源文件存在于生成上下文中。

1
2
$ docker --version
Docker version 1.4.1, build 5bc2ff8/1.4.1

Dockerfile:

1
2
3
$ cat Dockerfile
FROM centos
COPY"test","/"

目录内容:

1
2
3
4
$ ls -Al
total 4
-rw-rw-r-- 1 nottingham nottingham 29 Apr  1 14:21 Dockerfile
-rw-rw-r-- 1 nottingham nottingham  0 Apr  1 14:26 test

建立输出:

1
2
3
4
5
6
7
$ docker build  -t nottingham/test .
Sending build context to Docker daemon  2.56 kB
Sending build context to Docker daemon
Step 0 : FROM centos
 ---> 88f9454e60dd
Step 1 : COPY"test","/"
INFO[0000]"test",: no such file or directory

使用copy[src,dest]表单或add命令时也会出现类似的错误。有什么想法吗?


删除逗号和引号。用途:

1
2
FROM centos
COPY test /