fgrehm / vagrant-lxc

LXC provider for Vagrant
MIT License
1.21k stars 181 forks source link

Container doesn't get an IP address #459

Closed elemoine closed 6 years ago

elemoine commented 6 years ago

I am on Debian sid/unstable, and this is my Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  # config.vm.box = "glenux/jessie64-lxc"
  # config.vm.box = "debian/jessie64"
  config.vm.box = "fgrehm/precise64-lxc"
  config.vm.provider :lxc do |lxc|
    lxc.customize 'aa_profile', 'unconfined'
  end
  config.vm.network "private_network", ip: "192.168.2.100", lxc__bridge_name: 'vlxcbr1'
end

vagrant up ends with an lxc-info error:

$ vagrant up
Bringing machine 'default' up with 'lxc' provider...
==> default: Importing base box 'fgrehm/precise64-lxc'...
==> default: Checking if box 'fgrehm/precise64-lxc' is up to date...
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Setting up mount entries for shared folders...
    default: /vagrant => /home/elemoine/tmp/vagrant-lxc
==> default: Starting container...
==> default: Waiting for machine to boot. This may take a few minutes...
There was an error executing lxc-info

For more information on the failure, enable detailed logging by setting
the environment variable VAGRANT_LOG to DEBUG.

And I cannot SSH into the container created by vagrant up.

This is the full trace with VAGRANT_LOG set to DEBUG: http://paste.openstack.org/show/686662/. As you can see the container doesn't get an IP address.

Any idea what's wrong?

elemoine commented 6 years ago

OK, I figured it out. LXC networking is disabled by default in Debian. I wrote a quite howto showing how to set up vagrant-lxc on Debian Sid: https://github.com/elemoine/vagrant-lxc-howto.