Docker Community Forums

Share and learn in the Docker community.

Docker Add error message unhelpful

build
docker

(Jasonkania) #1

Hello,

I am using docker 1.12.1 on Ubuntu and am unable to add any files to the image. Neither COPY nor ADD work and give me the same useless single error making it difficult to figure out what the problem is. The contents of the docker file is the following two lines:

FROM centos:7.1.1503
ADD test /tmp

Here is the sequence of commands being run to test the situation:

root@ubuntu:/home/test/workdir# docker build - < DockerFile
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM centos:7.1.1503
—> 285396d0a019
Step 2 : ADD test /tmp
lstat test: no such file or directory
root@ubuntu:/home/test/workdir# touch test
root@ubuntu:/home/test/workdir# docker build - < DockerFile
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM centos:7.1.1503
—> 285396d0a019
Step 2 : ADD test /tmp
lstat test: no such file or directory

I have also tried the following to replace the ADD line above but I get the same response indicating that the command needs far better error output to make it at all user friendly:

ADD test /tmp
ADD test /tmp/test
ADD test /
COPY test /tmp
COPY test /tmp/test
COPY test /

I have also tried changing the permissions on the file to 777 with no luck as well as changing the owner of the file to the current user even though I am running the tool as root.

Unfortunately, the error is always the same giving no indication as to the source of the problem.

Any suggestions on how to debug and any timeline on fixing this problem which has been around for eons.

Thanks,

Jason


(Nathan Le Claire) #2

@jasonkania

You aren’t uploading (the full) build context in your invocation.

docker build - <DockerFile is not the correct invocation. The file should be called Dockerfile and you should specify a build context as an argument to build, e.g., docker build ..

Reading Dockerfile from STDIN (using - for the build context arg) uploads only the Dockerfile (there may be some additional tar magic / tricks possible that I’m not sure about, but easiest is to just use .).


(Jasonkania) #3

Nathan,

Thanks for the response. I will switch. It would be good to add a warning or other message when running Docker that indicates when no context has been supplied and that some commands will not work because I was doing all sorts of other RUN commands with several arbitrarily named Docker files without problems until I hit the ADD and COPY.

Thanks,

Jason