Tag Archives: Dockerfile

Dockerfile: “no such file or directory” error using ADD

Testing docker is really interesting, but sometimes it’s difficult to understand what’s wrong with some configuration.

A problem I found recently dealed with the ADD directive used in the Dockerfile. I was trying to start some services with supervisor but I got this error during the image build process

Step 19 : ADD supervisord.conf /etc/supervisor/conf.d/
2014/02/10 00:40:55 build: supervisord.conf: no such file or directory

The file was right there, in the same path of the Dockerfile, but docker couldn’t find it.

After a good read of the official documentation I learned the conxept of “build context”. When you are building an image, the source directory from which you are operating is the build context, but when you are building passing the Dockerfile from the standard input, there’s no build context!

So this is ok

$ docker build -t mydebian .

and this can’t work

$ docker build -t mydebian - < Dockerfile