Build fails ANY command COPY/ADD or mapping docker exec -v

This error is around a bit longer, e.g. issue #27233 and many more.

Anyway, all the solutions bring nothing in my case cos building fails EVERY time when COPY ADD or a mapping via Docker exec -v is involved in the Dockerfile. Hundreds of tries and not even one success.
Every Dockerfile from the repository fails if it contain these commands.

All path are relative to the build context, some errors I can prevent with having ADD/COPY before RUN commands but that is just a workaround for shorter files, actually I try to build the official PHP

and that Dockerfile has >250 lines with an severe amount of directory actions, how shall I reorder that w/o being a Linux-crack?

What can I do to get that running? I read for a week EVERY article I could find about this issue, tried hundreds of builds, soon as there is a folder access like COPY ADD or a mapping via Docker exec -v comes the error. How can it even be that your Software has such bugs? (obviously not fully handled since >2 years?)

AGAIN: I tried ALL the tips out there and the only thing that works a bit is having ADD / COPY before RUN commands, but that is not always possible. All path ARE relative with the build context as root.
Every build w/o those commands works perfect. Resetting the service doesent help either, nor anything else mentioned in those articles.
So please save your and my time and do not repeat that, this must be something else.


  • running on Debian or Win10 makes NO difference.
  • Docker 17.05.0-ce

Here some more information:

docker version

Version: 17.05.0-ce
API version: 1.29
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:04:27 2017
OS/Arch: linux/amd64

Version: 17.05.0-ce
API version: 1.29 (minimum version 1.12)
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:04:27 2017
OS/Arch: linux/amd64
Experimental: false

docker info

Containers: 7
Running: 0
Paused: 0
Stopped: 7
Images: 46
Server Version: 17.05.0-ce
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 25
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Kernel Version: 3.16.0-4-amd64
Operating System: Debian GNU/Linux 8 (jessie)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.469GiB
Name: debian
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Experimental: false
Insecure Registries:
Live Restore Enabled: false

WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No oom kill disable support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support

Exact steps are that I can not build ANY Dockerfile that contains COPY ADD or any path mapping.

Direct example: Building the original PHP container from Docker Hub

I wrote docker exec -v but exec does not have -v parameter, I meant docker run -v, surely everyone made that logical bridge as run is the only other container-executing command where a path mapping makes sense?

If I take out all commands that refers to any path on the host all works fine.
But including any off the ADD COPY or any path mapping via “docker run -it -v /Hostpath/:/containerpath/ [container-id] bash” throws an error which is
"no such file or directory" on COPY / ADD and
"The command […] returned a non-cero code" (wich is mosttly 127) on other commands
like this (starts at line 153 (shortend)
RUN set -xe _
_ […]

_ && docker-php-source extract _
The extract command in folder docker-php-source throws the error.
( Note that the folder exists as sub folder of the building folder so is in the correct build context )

As I wrote, placing ADD / COPY before RUN helps, in that Dockerfile I put line 151 “COPY docker-php-source /usr/local/bin/” nearly on top and there it works, but there are lot of other directory commands in that file and I have no idea how to rewrite that cos I am not a Linux crack.

If it is a path mapping the error is restricted access on the guest system,
but entering the container shows me that folder and file have 755 so all should be fine. (Besides that it is already not logical to think that the directories in the container can even have wrong permissions cos first the container works with root access and second then it would work for no one, not just me)

And last not least, while searching the net for this I saw lots of users with actual versions of docker facing the same problem

I WROTE: So please save your and my time and do not repeat that, this must be something else.
Sorry if that sounded rude. Point is when I ask someone I already tried all that I could find in the net. If I dont write that there will be lots of responds saying all that stuff again, from “restart service” to “place ADD before RUN” and so on. This simply wastes time as I tested all and nothing works.

Anyway, OS is:
Windows 10 Pro x64 2017 (up to date), CPU AMD A8-7600, 4GB RAM
or Debian Jessie in Virtualbox VM

To install Docker on Linux I use a script:

compiled from

sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install apt-transport-https ca-certificates -y

sudo sh -c "echo deb debian-jessie main > /etc/apt/sources.list.d/docker.list"
sudo apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

sudo apt-get update
sudo apt-cache policy docker-engine
sudo apt-get install docker-engine -y

sudo service docker start
sudo docker run hello-world

sudo group add docker
sudo groupadd docker
sudo gpasswd -a $USER docker
sudo service docker restart

this seems to work fine?