Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

Create a version of boot2docker that works as Vagrant "base box" #29

Closed
durdn opened this issue Dec 10, 2013 · 35 comments
Closed

Create a version of boot2docker that works as Vagrant "base box" #29

durdn opened this issue Dec 10, 2013 · 35 comments

Comments

@durdn
Copy link
Contributor

durdn commented Dec 10, 2013

It would be cool if a version of boot2docker could work as a Vagrant Base Box.

Unfortunately this would make it much bigger in size as it would require:

  • VirtualBox Guest Additions for shared folders, port forwarding, etc.
  • SSH with key-based auth support for the vagrant user
  • Ruby & RubyGems to install Chef and Puppet
  • Chef and Puppet for provisioning support

I understand this might be outside the scope of the project, but it would be cool nonetheless.

@mattapperson
Copy link

+1 even if it only worked to an extent

@boffbowsh
Copy link

Chef and Puppet would not be required - it's not a requirement of Vagrant base boxes to support Chef and Puppet.

@durdn
Copy link
Contributor Author

durdn commented Dec 14, 2013

@boffbowsh I actually copied the bullet list of requirements from the official documentation on Vagrant base boxes as it mentions: "The above are absolutely required of a base box in order to work properly with Vagrant".

But I am also puzzled by that and it would be cool if they could be skipped.

@mattapperson
Copy link

@durdn it says on their (the vagrant) site "Perhaps Chef, Puppet, etc. but not strictly required."

@steeve
Copy link
Contributor

steeve commented Dec 16, 2013

Well, you'll be glad to know that we are preparing something with the docker guys that should solve your problem in a pretty neat way imho: run docker on the host without ever ssh-ing into the VM


Steeve Morin

On Sun, Dec 15, 2013 at 6:08 PM, Matt Apperson notifications@github.com
wrote:

@durdn it says on their (the vagrant) site "Perhaps Chef, Puppet, etc. but not strictly required."

Reply to this email directly or view it on GitHub:
#29 (comment)

@durdn
Copy link
Contributor Author

durdn commented Dec 16, 2013

Awesome @steeve thanks for the update!

@mrmurphy
Copy link

feels

feels ^

@steeve
Copy link
Contributor

steeve commented Dec 16, 2013

refs moby/moby#1616

@mitchellh
Copy link

I just want to chime in on this. I think using Docker as client to a raw B2D VM is fantastic.

But for those who want it, it should be very easy to make a B2D base box: you just have to modify the bootsync.sh to add the Vagrant public key: https://github.com/mitchellh/vagrant/tree/master/keys

Then just package it up. I did this locally and it works and its super fast (vagrant up to b2d takes maybe 5 seconds). The process is a little crap right now (my problem, not b2d) because building the ISO has a bootstrapping problem, but I think if I have free time I should be able to solve that. I already have Packer templates to automate all this so hopefully I can publish something that is pretty push-button.

@durdn
Copy link
Contributor Author

durdn commented Dec 19, 2013

@mitchellh Fantastic Mitchell. I want to give this a go. Definitely keep me posted if you publish the Packer templates.

@parente
Copy link

parente commented Dec 21, 2013

+1 I have a hacky script that does this using the CoreOS Vagrantbox. Having something that boots even faster would be great.

@bfirsh
Copy link
Contributor

bfirsh commented Dec 30, 2013

It would be fantastic to have boot2docker working with Vagrant so we can use it with https://github.com/noplay/docker-osx . At the moment we're using an Ubuntu image which is ridiculously large.

@mitchellh – have you got a Packer script you can share?

/cc @josephschorr

@mitchellh
Copy link

Done, here you go: https://github.com/mitchellh/boot2docker-vagrant-box

:)

@teohm
Copy link

teohm commented Jan 8, 2014

@mitchellh how does boot2docker-vagrant-box handle shared folder between host machine and a container?

@mitchellh
Copy link

@teohm It doesn't, because Tiny Core Linux doesn't have VirtualBox guest additions support. If you use Vagrant with something like an Ubuntu VM, though, Vagrant will automatically install Docker for you and shared folders work just fine.

@steeve
Copy link
Contributor

steeve commented Jan 8, 2014

Actually, I'm coming to the conclusion that I might need to insert them. Sucks, but without them mounts don't work, which sucks.

See #43 and #62

@teohm
Copy link

teohm commented Jan 8, 2014

Any alternative(s) for B2D to share folder between host machine (osx) and
container?

I'm trying to setup dev env in container and sync app codebase from my Mac
host machine.

On Thursday, January 9, 2014, Mitchell Hashimoto wrote:

@teohm https://github.com/teohm It doesn't, because Tiny Core Linux
doesn't have VirtualBox guest additions support. If you use Vagrant with
something like an Ubuntu VM, though, Vagrant will automatically install
Docker for you and shared folders work just fine.


Reply to this email directly or view it on GitHubhttps://github.com//issues/29#issuecomment-31886175
.

Huiming

@steeve
Copy link
Contributor

steeve commented Jan 8, 2014

Well, you can always try to setup something like nfs, samba or even sshfs over the network.
Can be tedious, but it would work.

@mitchellh
Copy link

@teohm Again, assuming you use a heavier OS like Ubuntu or install some of pre-reqs on your own, Vagrant will do all this for you. Vagrant as it is released now supports VirtualBox shared folders, VMware shared folders, and NFS (host to guest). If you have any of those, it will automatically set them up.

The next version of Vagrant will support rsync, plain old SCP listening for file changes, and guest-to-host NFS (much better performance), at the least.

Again, Vagrant will configure these and run them all for you. The easiest thing to do to get started is probably just use Ubuntu with this, but with proper configuration, Vagrant should be able to also automatically configure b2d to have these, too.

@mitchellh
Copy link

@steeve VirtualBox shared folders would be a good starting area. You'll find quickly that the performance is ABYSMAL, however, and that'll affect utility of b2d. With only a few thousand files (Rails projects), the load time can be multiple orders of magnitude (I've seen 100x on large projects) slower than native. NFS brings this down considerably. NFS guest-to-host is VERY good.

I'll try to help you out here... I'll ping you and this thread when I have something to show.

@deinspanjer
Copy link

Someone else mentioned in a blog post the possibility of using 9P and diod as an alternative to NFS..

@SvenDowideit
Copy link
Contributor

@dduportal
Copy link
Contributor

@SvenDowideit
Copy link
Contributor

we're making boot2docker as simple and small as possible - so at this point, adding tools that are not relevant to all usecases (bare HW, vbox, vagrant, hyper-v, vmware, kvm, etc) is not on the plan. This may change in future, but we havn't completed our original feature set yet.

@benjamine
Copy link

I'm trying to get started with boot2docker on windows, but without support for shared folders, and without a docker CLI on the windows host (which is there on OSX), it's hard to find it useful beyond a cool demo.
I have my Dockerfile on the windows machine, how can I build it? (ie. I need to run: docker build, on windows, not sshing into the boot2docker VM, unless I can see my files there using a VBox shared folder)

@LukasRos
Copy link

LukasRos commented Jul 2, 2014

@benjamine You should be able to run docker build from your Windows machine because the build context (= current directory) is automatically uploaded to the docker host (the VM). So you can use the ADD instruction in a dockerfile to add files from your Windows machine to a new image.

@benjamine
Copy link

@LukasRos but how can I run docker on the windows machine? I don't want to run it in the VM (my Dockerfile is not there, it's on the windows host) as far as I could test, "docker" command is not there, when I double-click the desktop icon that's opening an ssh session into the VM (where yes, docker is available), but of course my files are not, I need to either:

  • run docker on the windows host (preferrable)
  • have my files in the boot2docker VM
    but neither of those seem possible right now

@LukasRos
Copy link

LukasRos commented Jul 2, 2014

@benjamine Not exactly sure about Windows since I'm using it on a Mac but the basic setup is the same:

  • the docker daemon runs inside the VM and that's where the docker containers and images are actually stored
  • the docker command line tool can also be run from Windows and connect to the daemon inside the VM over TCP/IP; if it's not available then probably your PATH setup is not correct

Maybe someone on IRC who also uses Windows can help you better than me ...

@benjamine
Copy link

I know it works on OSX, this is what I wrote:

without a docker CLI on the windows host (which is there on OSX)

but why do you say "the docker command line tool can also be run from Windows" when you don't use Windows, and I'm saying precisely that's not there (and I have tested it in at least 2 Windows machines)? so starting over: there's no docker CLI on windows, maybe it's hidden? maybe docker CLI doesn't run on windows? (at least Go has support for windows)

@gaffa
Copy link

gaffa commented Nov 14, 2014

Hi!
I have started something and it is already doing something :)
http://igaffa.blogspot.be/2014/11/docker4windows-docker-on-windows.html
https://github.com/gaffa/docker4windows
Feel free to contribute. I do not have that much time to implement the missing bits.
Also to the boot2docker-Team: feel free to integrate whatever parts you like.
Regards

@SvenDowideit
Copy link
Contributor

@gaffa you do know there already is a windows boot2docker installer that does everything, and will include the new native windows docker client very soon?

and we added vbox based virtual folders in 1.3.0.

@gaffa
Copy link

gaffa commented Nov 14, 2014

Hi!
What exists and could be downloaded yesterday did not help as there is no "docker command". But maybe its worth trying boot2docker with the batch file Form my approach once more. Does it forward ports to the host?
Also can you provide me with a link to the issue where a native client is developed and provide me with a better guess in what " soon" means?
If we are talking months or many weeks this would still be worth the work.

@gaffa
Copy link

gaffa commented Nov 14, 2014

Also: how do shared folders work? Is the current work dir automatically mounted or does one have to do that manually?

@SvenDowideit
Copy link
Contributor

b2d adds a host only network, so container ports are forwarded and accessible (nat port forwarding is both dangerous and not reliable)

docker client for windows - moby/moby#9113

I'm pretty sure its very close - Microsoft seems to have several people on it, and the code already works - its now a matter of breaking it up into reviewable and testable parts.

yes - boot2docker 1.3 auto mounts your user dir - on windows its /c/Users

mind you, I'm using a poor man's client on there too alias docker="boot2docker ssh docker" :)

@gaffa
Copy link

gaffa commented Nov 14, 2014

I have removed my repo and blog post as it seems to be working with boot2docker as well. Maybe consider documenting the workaround with alias or .bat-File forwarding the command to boot2docker or even include an alias to boot2docker with the name docker?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests