wurmlab / oswitch

Provides access to complex Bioinformatics software (even BioLinux!) in just one command.
76 stars 9 forks source link

docker rather than boot2docker on Mac #28

Closed sjackman closed 9 years ago

sjackman commented 9 years ago

On my Mac I use docker, CoreOS, Vagrant and VirtualBox rather than boot2docker. Can oswitch be configured to work with this setup? The tool looks fantastic! Thanks for your work.

Cheers, Shaun

yeban commented 9 years ago

There are two aspects of oswitch that are OS dependent (Linux / OSX) -

  1. What paths to mount inside the container.
  2. What should be uid of the user created inside the container.

The list of mountpoints is based on the "perceived host" - Linux / OSX. But in case of OSX, the "true host" is boot2docker, or in your case CoreOS, running in VirtualBox. The list of mountpoints that oswitch prepares should be mounted in boot2docker first, for them to be mounted in turn within the container. By default this works great for home directory, as boot2docker mounts home directory automatically. But other directories should be manually mounted within boot2docker as described in FAQ. (We are waiting for boot2docker to take care of this automatically for us. In case they don't we will probably automate it ourselves). So whatever your setup, as long as you can ensure relevant paths from OSX are also mounted within the "true host" (boot2docker, CoreOS) it will work.

The username is picked from the "perceived host", but the uid and gid are picked from the "true host" (again, perceived and trust host are same in case of Linux but different in case of OSX), because the directories are actually mounted from 'boot2docker' ... or you won't be able to read & write to the host filesystem from within the container. uid and gid are derived by running boot2docker ssh id -u and boot2docker ssh id -g. If your setup supports querying uid and gid, you can get this to work by aliasing the right command to 'boot2docker'.

It would definitely be advantageous for us to be able to support any "docker runtime" on OSX. But we don't have the resources to make that happen. We are open to pull requests and discussion on how to best make it happen though.

sjackman commented 9 years ago

Thanks for the detailed answer. Sounds like for now it'll be easier for me to set up boot2docker.