Search code examples
linuxdockerredhat

docker build fails to use Dockerfile in **sticky** directory?


Running docker 1.12.1; on RH 7.2 64 bit.

docker in general works fine; my commands to run containers; or to import archives ... all fine.

But when I try this here:

/data $ docker build -t foo/bar:1 .

I get:

unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /data/Dockerfile: no such file or directory

Then I tried:

/data $ lstat Dockerfile
bash: lstat: command not found...
Similar command is: 'stat'

/data $ stat Dockerfile
stat: cannot stat ‘Dockerfile’: No such file or directory

but

/data $ stat /data/Dockefile 
File: ‘/data/Dockefile’
Size: 471           Blocks: 8          IO Block: 4096   regular file
Device: fd03h/64771d    Inode: 127         Links: 1
Access: (0600/-rw-------)  Uid: (1125706/guenthne)   Gid: (  600/  gloadl)
Access: 2016-09-05 16:37:42.835090097 +0200
Modify: 2016-09-05 16:37:42.835090097 +0200
Change: 2016-09-05 16:37:42.835090097 +0200
Birth: -

And just to be clear: when I use the same command; and the same dockerfile on my local Ubuntu Linux, all of that works fine. And no, /data is not a symbolic link; but I figured: it has the sticky bit set. And unfortunately, all directories on that system that I have write permission to (/data, /home, and /tmp) are sticky.

Questions are:

  1. Any idea what is causing this problem?
  2. Of course, more important: solutions, or at least workarounds?

Update, as requested:

> ls -al $(which docker)
-rwxr-xr-x 1 root root 13914136 Aug 18 07:07 /bin/docker

Solution

  • Posting the answer to my problem here; just in case somebody accidentally runs into the same problem; as this isn't about stat, lstat, or anything.

    The problem was a simple typo: when copying the working Dockerfile to my remote build server; I messed up, and named the file Dockefile instead of Dockerfile (so the r missing within Docker)

    In essence, docker gives the correct message:

    unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /data/Dockerfile: no such file or directory

    but unfortunately, that prefix about "context/symlinks" is just misleading.