signalfx / maestro-ng

Orchestration of Docker-based, multi-host environments
https://signalfx.com
Apache License 2.0
683 stars 83 forks source link

Unclear error message "cannot mount volume over existing file" #177

Closed skrysmanski closed 8 years ago

skrysmanski commented 8 years ago

As a Docker newby I just wrote a Dockerfile like this:

FROM ubuntu

VOLUME /myvol

COPY test.txt /myvol

WORKDIR /other_dir

Building this Docker image fails like this (test.txt exists):

$ docker build .
Sending build context to Docker daemon 15.87 kB
Step 1 : FROM ubuntu
 ---> 0f192147631d
Step 2 : VOLUME /myvol
 ---> Running in 22355bec2bc9
 ---> 39088c75eb60
Removing intermediate container 22355bec2bc9
Step 3 : COPY test.txt /myvol
 ---> c7201283f80d
Removing intermediate container 941ce3371339
Step 4 : WORKDIR /other_dir
cannot mount volume over existing file, file exists /var/lib/docker/aufs/mnt/16dc3b9cd2832122ecdd289028fee023bdaa2000bb6c59fd94accd4ae9da8c7c/myvol

I figured out that the error is the missing / on the destination of the COPY instruction.

One problem here is that the error message could be more clear (i.e. it doesn't state that /myvol is not a directory but a file and thus the mount fails).

But the bigger problem here that this error is reported for step 4 (WORKDIR) and not for step 2 or 3. I think this should be improved.

mpetazzoni commented 8 years ago

This is not a MaestroNG problem. Maybe https://docs.docker.com/engine/reference/builder/ will help you?

skrysmanski commented 8 years ago

@mpetazzoni I'm totally sorry. This issue was meant for the docker repository. I'm not sure how I ended up on your repo.