docs icon indicating copy to clipboard operation
docs copied to clipboard

More explanation needed about sharing files between host and containers on OSX

Open JimRoepcke opened this issue 9 years ago • 4 comments

File: docker-for-mac/osxfs.md

I've installed Docker for the first time in my life, on OS X.

[jim@Jim-Roepckes-MacBook-Pro ~]$ docker version
Client:
 Version:      1.13.0
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Wed Jan 18 16:20:26 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      1.13.0
 API version:  1.25 (minimum version 1.12)
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Wed Jan 18 16:20:26 2017
 OS/Arch:      linux/amd64
 Experimental: true

I see in Preferences there are some default shared folders:

image

That's great, because I want to be able to edit my Swift files on my Mac and run them in my docker container. I ran docker run hello-world and that worked. Then I did:

docker pull swiftdocker/swift
docker run --privileged -t -t --name swiftfun swiftdocker/swift:latest /bin/bash

I tried cd /Users. No dice. Okay... maybe those shared folders are in /mnt?

root@156caeeb3dcc:/# cd /mnt
root@156caeeb3dcc:/mnt# ls -l
total 0

Then I went to docker-for-mac/osxfs.md, linked from the screenshot above. It does not explain why these shared directories are not visible in my container or how to mount them. The screenshot says "These macOS directories (and their subdirectories) can be bind mounted into Docker containers" but it doesn't say how, in the UI or on this page. I think how to actually do that should be the first piece of information I find on this page.

I've googled for docker mac osxfs bind and the first link was this page.

The fact that I can't find a single link on the first page of Google that appears to explain how to make the paths in that screenshot appear in a docker container is making me think "maybe this was just supposed to work automatically but this docker container is broken? Or Docker has a bug?".

If there's a command I need to run to enable this, please add it to this page and let me know. Thanks!

JimRoepcke avatar Jan 23 '17 03:01 JimRoepcke

TIL "using the -v bind mount syntax" was supposed to obviously mean "add a -v parameter to the docker run command".

Please improve that page and make that fact explicit. It's not obvious to newcomers.

JimRoepcke avatar Jan 23 '17 07:01 JimRoepcke

dibs for hackathon.

Seems to be already fixed. Documentation has example for -v use.

bdwill avatar Apr 17 '17 21:04 bdwill

Thanks @bdwill

mdlinville avatar Apr 19 '17 18:04 mdlinville

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

/lifecycle locked

docker-robott avatar Mar 05 '23 03:03 docker-robott