Skip to content

Volume mount doesn't work on a Mac in /tmp/ directory #1039

Closed

Description

@toli

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.

Activity

  1. kojiromike commented on Feb 28, 2015

    @kojiromike

    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.

  2. toli commented on Mar 4, 2015

    @toli
    Author

    ah, seems like use error. thanks

  3. j2kun commented on Jun 1, 2016

    @j2kun

    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.

  4. salaev-privo commented on Nov 14, 2017

    @salaev-privo

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

  5. christianhujer commented on Aug 11, 2018

    @christianhujer

    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/.
  6. jcapogna commented on Jan 1, 2019

    @jcapogna

    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.

  7. added a commit that references this issue on Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions