fgrehm/vagrant-lxc

support for the docker provisioner?

Closed this issue · 6 comments

Has anybody used the docker provisioner with the lxc provider?

Ubuntu 14.10
vagrant 1.7.1
vagrant-lxc 1.1.0

I then get the error

==> default: Sending build context to Docker daemon 
==> default: time="2015-04-07T16:20:09Z" level="fatal" msg="Cannot connect to the Docker daemon. Is 'docker -d' running on this host?" 

This appears in /var/log/upstart/docker.log:

ount: block device cgroup is write-protected, mounting read-only
mount: cannot mount block device cgroup read-only
mount: block device cgroup is write-protected, mounting read-only
mount: cannot mount block device cgroup read-only
mount: block device cgroup is write-protected, mounting read-only
mount: cannot mount block device cgroup read-only
mount: block device cgroup is write-protected, mounting read-only
mount: cannot mount block device cgroup read-only
mount: block device cgroup is write-protected, mounting read-only
mount: cannot mount block device cgroup read-only
mount: block device cgroup is write-protected, mounting read-only
mount: cannot mount block device cgroup read-only
mount: block device cgroup is write-protected, mounting read-only
mount: cannot mount block device cgroup read-only
mount: block device cgroup is write-protected, mounting read-only
mount: cannot mount block device cgroup read-only
mount: block device cgroup is write-protected, mounting read-only
mount: cannot mount block device cgroup read-only
mount: block device cgroup is write-protected, mounting read-only
mount: cannot mount block device cgroup read-only
mount: block device cgroup is write-protected, mounting read-only
mount: cannot mount block device cgroup read-only
/var/run/docker.sock is up
Warning: '-r' is deprecated, it will be removed soon. See usage.
INFO[0000] +job serveapi(unix:///var/run/docker.sock)   
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock) 
FATA[0000] permission denied                            
ccope commented

Could you explain a bit more about what you're trying to do? Are you trying to run a container with the docker daemon inside?

If what @ccope described is what you want to do, I can say that it is possible, I've done that many times on the past but it requires a few tweaks.

First you need to start the container unconfined like:

Vagrant.configure("2") do |config|
  # vagrant-lxc specific tweaks for getting docker to run inside the container
  config.vm.provider :lxc do |lxc|
    lxc.customize 'aa_profile', 'unconfined'
  end
end

Then you need to install LXC on the container and configure Docker to use the LXC execution driver. Check out this code for some inspiration on how to do that.

That used to work on an Ubuntu 14.04 host with LXC 1.0 and Docker 1.0+, dunno if it still works.

Using the libcontainer execution driver might work with a few tweaks, please look into moby/moby#6783 for more.

I'd thought about documenting this on the past but never got to it. If someone is up for putting up a Wiki page on this it would be awesome!

HTH

Yes, I want to add the line config.vm.provision "docker" to my Vagrantfile.

Unlike some of my other vagrant environments, the overhead of VirtualBox isn't a deal-breaker, so I'll probably just stick with that for now. OTOH, if there's somebody else that wants to team up and get this running and documented properly, I'd be willing to lend a hand.

Yes it does, thanks!

Hey, sorry for the silence here but this project is looking for maintainers 😅

As per #499, I've added the ignored label and will close this issue. Thanks for the interest in the project and LMK if you want to step up and take ownership of this project on that other issue 👋