Skip to content

Instantly share code, notes, and snippets.

@fgrehm
Last active December 16, 2015 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fgrehm/5424514 to your computer and use it in GitHub Desktop.
Save fgrehm/5424514 to your computer and use it in GitHub Desktop.
Vagrant + Docker notes

To kick off the provider would be nice to have the big picture of out how Vagrant features / commands map to docker "stuff". These are thoughts about how the integration might look like under the hood:


vagrant up

  • how can we tell docker to "just start" a container? "docker start base" would start the base image right?
  • would probably need to commit the base "box" image and interact with that
  • would it make sense to have a "commandless" docker run -d <image>?
  • on "pure lxc" it basically means a "lxc-create" if the container has not been created yet and a "lxc-start -d"
  • how can we get the container IP from the command line to SSH into it?

shared folders

  • I saw some github issue action a while ago that there was some thinking around something related to that (something like data volumes?)
  • on "pure lxc" I just pass in '-s lxc.mount.entry=...' to lxc-start

vagrant box

  • does it map directly to docker images? what are the contents of an image?
  • all boxes will need to have an ssh server running so that people can use provisioners and other plugins that depend on it. does the base image come with it? I can't remember now
  • on "vanilla lxc" we have
    • a metadata.json with optional template params for lxc-create (this file is required by vagrant and just needs to have a "provider" key, the rest is up to us)
    • the rootfs tarball
    • the lxc template script which gets symlinked to the right folder so that "lxc-create" finds it
    • the current lxc template script is the same that comes with ubuntu 12.10 without the download / debootstrap part (i handle that when packaging the box)

vagrant halt

  • maps to "docker stop" + "docker wait"?

vagrant destroy

  • maps to "docker rm" ?

port forwarding

  • could use docker's built in port forwarding + a custom "vagrant port" command to lookup the public ports NATed
  • it won't work for localhost redirects, we could use "redir" as it is currently implemented on vagrant-lxc already
@shykes
Copy link

shykes commented Apr 23, 2013

Hey Fabio,

Thanks for putting this together! Would you mind making it a comment on the related issue (moby/moby#404)?

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