AlmirKadric-Published / docker-tuntap-osx

A tuntap shim installer for "Docker for Mac"
MIT License
330 stars 65 forks source link

Docker Toolbox compatible? #15

Closed onpaws closed 6 years ago

onpaws commented 6 years ago

Thanks for your efforts with this lovely project! This isn't a bug with your project so much as a question, please feel free to redirect me elsewhere if this is the wrong place. Definitely NOT a complaint either, this project looks sweet, just a developer looking for another developer's opinion. :)

My goal is to get this docker-compose file working on my Mac. [1] It's been surprisingly challenging, I think because of the problem docker-tuntap-osx solves.

TL, DR

Do you think this project could be made to work with Docker Toolbox + the new Xhyve driver?

Back story

The container I need to use is configured to point to localhost, and I'd prefer to avoid meddling with upstream configs if possible.

I noticed the README says "Docker for Mac". So I did a search in the repo for 'docker toolbox' and no results.

Curious, how much of a lift do you think this would be, knowing Docker for Mac and the Xhyve driver both use Hypervisor.framework?

To recreate my env, try the following. And no, Docker for Mac and Docker Toolbox don't clobber each other.

# install Docker Tools
brew install docker-compose docker-machine docker
brew install docker-machine-driver-xhyve

# you may need create a default machine
docker-machine create --driver xhyve default

# clone the React Native project
git clone git@github.com/fbsamples/f8app.git
cd f8app

# spin up the machines
docker-compose up

With Docker running, from your Mac try http://localhost:4040. I get an error.

[1] It's a React Native project Facebook published back in December. Doesn't appear to be maintained but nevertheless useful for learning.

Details: macOS 10.13.2 homebrew 1.5.0 Docker version 18.01.0-ce, build 03596f5 docker-compose version 1.18.0, build 8dd22a9 docker-machine version 0.13.0, build 9ba6da9

AlmirKadric commented 6 years ago

Im just going to throw this out there and apologies if it seems condescending, but are you aware that docker has a pre-packaged binary for for mac and windows called docker-for-mac(https://docs.docker.com/docker-for-mac/) and docker-for-windows(https://docs.docker.com/docker-for-windows/).

Essentially docker-for-mac is a pre-packaged mac application which sets up docker which is already has a xhyve VM under the hood. No need for docker-machine. However since the default configuration of that VM doesn't connect to or has configuration to allow connecting to a tap interface I created this project.

Essentially if you just install docker-for-mac and use this project, you will get a docker environment which allows you to route directly to the containers and the docker networks you create.

Now to answer your original question, can this project work with docker-machine using the xhyve driver. Although this project is more a shim installer for the docker-for-mac bundled application. We can add the functionality you're looking for if it is really required. Alternatively you can use the same techniques this project uses to get docker-machine working. What you need to do is:

Let me know if you have any questions regarding the above, or if you still need the docker-machine script.

onpaws commented 6 years ago

Thanks Almir! Very helpful reply, not condescending, I appreciate you taking the time.

I am aware of Docker for Mac. The reason I prefer to stick with Toolbox is because all my other development dependencies are provided by Homebrew - eg Redis, PostgreSQL, Node, etc. Mostly out of convenience I like to have them all in one place, one command to update everything, etc.

I was curious, what are the benefits of Docker for Mac over the Toolbox version? I use the xhyve driver.

AlmirKadric commented 6 years ago

Understood, the benefits of using docker for mac are the tools it comes with. Not to mention the xhyve VM is configured for you (albeit not 100% the way you want it) (not an experimental driver but a 100% supported setup).

screen shot 2018-01-21 at 14 33 42 screen shot 2018-01-21 at 14 33 52

However your reasons for using docker toolbox are understandable it really comes down to how much you want to manage and how you use docker.

Also if you want to take a look at how I manage my docker environments (for node.js projects) take a look at my other project https://github.com/AlmirKadric-Published/helpers-docker-nodejs I automated the use of this project as well as the additional steps required for both windows and mac.

AlmirKadric commented 6 years ago

@onpaws can I consider this issue resolved?

onpaws commented 6 years ago

Yes, you've been very helpful Almir. Thanks.