Skip to content
This repository was archived by the owner on Feb 27, 2018. It is now read-only.

WIP 'docker share' using rsync or sshfs - only does 'pwd' - #247

Closed
SvenDowideit wants to merge 3 commits into
masterfrom
docker-share-rsync
Closed

SvenDowideit wants to merge 3 commits into
masterfrom
docker-share-rsync

Conversation

@SvenDowideit

Copy link
Copy Markdown
Contributor

Thought I'd just try it :)

The --share=smb share driver flag does not work - we need to merge #245 and some docker/pkg/mflags changes (or #243 and and some more fixes)

@SvenDowideit

Copy link
Copy Markdown
Contributor Author

This quick hack does a tce-load -iw sshfs, and sets up all the parts - and is very rough. but it works well enough to allow me to build docker using make cross, and for the result to be on my OSX box's filesystem.

bash-3.2$ ../../boot2docker/boot2docker-cli/boot2docker-cli start
Waiting for VM and Docker daemon to start...
..............................
Started.
Your DOCKER_HOST env variable is already set correctly.

bash-3.2$ ls -la bundles
ls: bundles: No such file or directory
bash-3.2$ ../../boot2docker/boot2docker-cli/boot2docker-cli ssh mount | grep Users
bash-3.2$ ../../boot2docker/boot2docker-cli/boot2docker-cli share
Please be patient, downloading sshfs modules
bash-3.2$ ../../boot2docker/boot2docker-cli/boot2docker-cli ssh mount | grep Users
[email protected]:/Users/sven/go/src/github.com/docker/docker on /Users/sven/go/src/github.com/docker/docker type fuse.sshfs (rw,nosuid,nodev,relatime,user_id=1000,group_id=50,allow_other,max_read=65536)
bash-3.2$ make cross
mkdir bundles
docker build -t "docker:master" .
Sending build context to Docker daemon 54.43 MB
Sending build context to Docker daemon

..... 8< snip .........

docker run --rm -it --privileged -e TESTFLAGS -e TESTDIRS -e DOCKER_GRAPHDRIVER -e DOCKER_EXECDRIVER -v "/Users/sven/go/src/github.com/docker/docker/bundles:/go/src/github.com/docker/docker/bundles" "docker:master" hack/make.sh binary cross

---> Making bundle: binary (in bundles/1.2.0-dev/binary)
Created binary: /go/src/github.com/docker/docker/bundles/1.2.0-dev/binary/docker-1.2.0-dev

---> Making bundle: cross (in bundles/1.2.0-dev/cross)
Created symlinks: /go/src/github.com/docker/docker/bundles/1.2.0-dev/cross/linux/amd64/docker /go/src/github.com/docker/docker/bundles/1.2.0-dev/cross/linux/amd64/docker-1.2.0-dev /go/src/github.com/docker/docker/bundles/1.2.0-dev/cross/linux/amd64/docker-1.2.0-dev.md5 /go/src/github.com/docker/docker/bundles/1.2.0-dev/cross/linux/amd64/docker-1.2.0-dev.sha256
Created binary: /go/src/github.com/docker/docker/bundles/1.2.0-dev/cross/linux/386/docker-1.2.0-dev
Created binary: /go/src/github.com/docker/docker/bundles/1.2.0-dev/cross/linux/arm/docker-1.2.0-dev
Created binary: /go/src/github.com/docker/docker/bundles/1.2.0-dev/cross/darwin/amd64/docker-1.2.0-dev
Created binary: /go/src/github.com/docker/docker/bundles/1.2.0-dev/cross/darwin/386/docker-1.2.0-dev
Created binary: /go/src/github.com/docker/docker/bundles/1.2.0-dev/cross/freebsd/amd64/docker-1.2.0-dev
Created binary: /go/src/github.com/docker/docker/bundles/1.2.0-dev/cross/freebsd/386/docker-1.2.0-dev
Created binary: /go/src/github.com/docker/docker/bundles/1.2.0-dev/cross/freebsd/arm/docker-1.2.0-dev

bash-3.2$ ls -la bundles/1.2.0-dev/
binary/ cross/
bash-3.2$ ls -la bundles/1.2.0-dev/cross/
darwin/  freebsd/ linux/
bash-3.2$ ls -la bundles/1.2.0-dev/cross/darwin/
386/   amd64/
bash-3.2$ bundles/1.2.0-dev/cross/darwin/amd64/docker version
Client version: 1.2.0-dev
Client API version: 1.15
Go version (client): go1.3.1
Git commit (client): 2aaa889-dirty
OS/Arch (client): darwin/amd64
2014/09/01 22:14:18 Error response from daemon: client and server don't have same version (client : 1.15, server: 1.14)
bash-3.2$ git diff Makefile
diff --git a/Makefile b/Makefile
index 40c623a..1af4178 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,8 @@

 # to allow `make BINDDIR=. shell` or `make BINDDIR= test`
 # (default to no bind mount if DOCKER_HOST is set)
-BINDDIR := $(if $(DOCKER_HOST),,bundles)
+BINDDIR := bundles
+#BINDDIR := $(if $(DOCKER_HOST),,bundles)
 # to allow `make DOCSPORT=9000 docs`
 DOCSPORT := 8000

bash-3.2$

@SvenDowideit SvenDowideit changed the title initial 'docker share' using rsync - only does 'pwd' initial 'docker share' using rsync or sshfs - only does 'pwd' Sep 1, 2014
@SvenDowideit SvenDowideit changed the title initial 'docker share' using rsync or sshfs - only does 'pwd' WIP 'docker share' using rsync or sshfs - only does 'pwd' Sep 1, 2014
@SvenDowideit

Copy link
Copy Markdown
Contributor Author

this could close #66

@nathanleclaire

Copy link
Copy Markdown
Contributor

👍

I will play with this some when I get a chance. rsync driver idea is very interesting

Comment thread cmds.go

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be really fun if you did it from /usr >:)

Maybe we could have this check to make sure the directory you're trying to mount on top of either doesn't exist or is empty inside the VM before we mount? (potentially with a "force" flag)

Also, wouldn't it be useful to be able to specify both a "share source" and a "share target" here, optionally? (defaulting the first to pwd as it is below, and the second to the value of the first, of course, as it is now)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we were actually going to release this, we'd have to fix the many layers of races by mounting the dir's into hashed dirs. You need to avoid clashes with other users', clashes with shares from other computers, and all sorts of stuff.

@eelcocramer

Copy link
Copy Markdown

Very helpful. I've tried this out and it works perfectly after changing the hard coded paths in cmds.go. Anyone that is attempting to try this out themselves: do not forget to change these paths. 👍

@jstoja

jstoja commented Oct 8, 2014

Copy link
Copy Markdown

I'm currently trying this too.
@eelcocramer What is working for you rsync or sshfs?

I'm getting an error on the sshfs command, being "reset by peer".
I'm looking for a solution. Keep you in touch.

UPDATE: Don't forget to put the remote sharing in the OSX options

@jstoja

jstoja commented Oct 8, 2014

Copy link
Copy Markdown

The sshfs is working very well after some tricks.
To resolve some rights problems, you can use the options : -o allow_other -o uid=XX -o gid=XX to set the target user and group of files on the container.
It's not as fast as I expected but it's way better than Samba.

If in some days there's nothing I'll try to PR this.

@jstoja

jstoja commented Oct 13, 2014

Copy link
Copy Markdown

@SvenDowideit Is this a will to map the given directory to the same directory inside the boot2docker vm ?
I guess it can be a good idea to have a cmd option to specify where we want it to be mapped.
For example:
boot2docker share /Library/WebServer/Documents/ --to-directory /var/www
So the Docker run cmd can be used for linux and osx users.
docker run -v /var/www/ ...

@SvenDowideit

Copy link
Copy Markdown
Contributor Author

I havn't had a chance to look into this lately

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants