Module: VagrantPlugins::Ventriloquist::Cap::Debian::PrepareContainerForDocker

Defined in:
lib/ventriloquist/cap/utils/debian/prepare_container_for_docker.rb

Class Method Summary collapse

Class Method Details

.prepare_container_for_docker(machine) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ventriloquist/cap/utils/debian/prepare_container_for_docker.rb', line 6

def self.prepare_container_for_docker(machine)
  machine.communicate.tap do |comm|
    # Disable the default lxc bridge to prevent issues when starting the container
    if ! comm.test('test -f /etc/default/lxc')
      comm.sudo '
cat <<STR > /etc/default/lxc
LXC_AUTO="false"
USE_LXC_BRIDGE="false"
STR
apt-get update && \
apt-get install -y --force-yes lxc \
        -o Dpkg::Options::="--force-confdef" \
        -o Dpkg::Options::="--force-confold"'
    end

    # Switch to lxc execution driver as wasn't able to get libcontainer to work
    if ! comm.test('$(grep -q "-e lxc" /etc/default/docker)')
      comm.sudo '
cat <<STR >> /etc/default/docker
DOCKER_OPTS="-e lxc ${DOCKER_OPTS}"
STR
service docker restart && sleep 5'
    end
  end
end