Compose: Volume mount doesn't work on a Mac in /tmp/ directory

Created on 27 Feb 2015  路  6Comments  路  Source: docker/compose

When following the Compose example at http://docs.docker.com/compose/#installation-and-set-up in the /tmp/composetest directory on a Mac, i'm seeing the following error:

web_1   | python: can't open file 'app.py': [Errno 2] No such file or directory

On a Mac, /tmp/ is actually in /private/tmp/.
If i move the underlying /tmp/composetest to any other location (ie /Users/toli/dev/composetest), the example works without any changes.

Most helpful comment

I agree with @j2kun. Is there a good reason why this fails silently?

I just wasted a few hours debugging trying to mount a file in /tmp while doing development on my Mac. It would have been a lot more obvious if the docker mount actually failed and logged something.

All 6 comments

When you say _on a Mac_ you mean Boot2Docker, right? If so, then, your Docker host is the Boot2Docker virtual machine, not your Mac. Volumes are on the host. Volumes within /Users usually work because modern Boot2Docker creates a share between the Mac and the Docker host at the same path.

screen shot 2015-02-28 at 11 56 40 am

But /tmp is harder, because it is needed by the VM OS itself, and it is permissions-sensitive, so you can't simply share it with the VM.

ah, seems like use error. thanks

The problem here is that docker-compose silently fails (and mounts an empty volume!) instead of giving an error. It took me a few hours to figure this out. This issue should be re-opened.

Stuck with the same issue on Linux - can't map directory in /tmp

I've experienced the same issue. That docker silently mounts empty volumes when trying to use paths from /tmp/. There are two issues with this for me:

  • That docker does something else instead, silently, without giving an error message.
  • That I cannot mount from /tmp/. I know the implications, but I wanted to make /tmp/.X11-unix/X0 available to a container, and that I can't, means I have to use --net=host instead, and I'm not sure whether that's any better than -v /tmp/.X11-unix/.

I agree with @j2kun. Is there a good reason why this fails silently?

I just wasted a few hours debugging trying to mount a file in /tmp while doing development on my Mac. It would have been a lot more obvious if the docker mount actually failed and logged something.

Was this page helpful?
0 / 5 - 0 ratings