vocker 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c85ef7c68884d8019894cc7d582743749470350b
4
- data.tar.gz: 8afc3a12d801e8a57b6906cf2033b70bd5df232c
3
+ metadata.gz: 01ebe4e117bf2353cbc0ce30465d58fcde38ab67
4
+ data.tar.gz: 4414a6eef3b96935e53ea2346676aa329e1d80a7
5
5
  SHA512:
6
- metadata.gz: 60c268d5a0c91851e414f6eda5c88a057169288a3f90d312836ad5fea4868ea7d19cd8655ac25db35646839babd6585e115303dfee6adec9c507e7c909110c8d
7
- data.tar.gz: d8dda39a64b9b09e2ee38534ee36259516825413cb3b9810b010300efb7adc08f8a8c8bac0a4c342be6f7c9eed1a980e974b2c63a12ee8499733f29b377ce7aa
6
+ metadata.gz: 6b18a0828dc7f538e0d35d0832e71239a0d4c60ee596366d1050a4214947dc2ce7f43bb4f41fe9212d0b90af274da4897a3d9b675379543123586a962c7c8ca8
7
+ data.tar.gz: 53d6655eceab26f844e48c12c4aa4da9d578abef09a58a41ccdda58d16e6321e21e75f193253a18caedce57c91a8a0eab72d08b3a714de5fea3c95e9ccfb256c
@@ -1,3 +1,9 @@
1
+ ## [0.3.2](https://github.com/fgrehm/vocker/compare/v0.3.1...v0.3.2) (October 12, 2013)
2
+
3
+ - Add support for additional parameters to be passed to the docker run cmd [GH-8](https://github.com/fgrehm/vocker/pull/8)
4
+ - Add `vagrant` user to the docker group in order to avoid "sudoing" [GH-5](https://github.com/fgrehm/vocker/issues/5)
5
+ - Attempt to start the docker service if it is not running
6
+
1
7
  ## [0.3.1](https://github.com/fgrehm/vocker/compare/v0.3.0...v0.3.1) (October 3, 2013)
2
8
 
3
9
  - Check if container is running before trying to restart
@@ -13,7 +13,7 @@ GIT
13
13
  PATH
14
14
  remote: .
15
15
  specs:
16
- vocker (0.3.1)
16
+ vocker (0.3.2)
17
17
 
18
18
  GEM
19
19
  remote: https://rubygems.org/
@@ -75,7 +75,7 @@ GEM
75
75
  thor (0.18.1)
76
76
  vagrant-cachier (0.3.2)
77
77
  vagrant-global-status (0.1.1)
78
- vagrant-lxc (0.5.0)
78
+ vagrant-lxc (0.6.3)
79
79
  vagrant-pristine (0.2.0)
80
80
 
81
81
  PLATFORMS
data/README.md CHANGED
@@ -65,6 +65,7 @@ containers to run:
65
65
  ```ruby
66
66
  Vagrant.configure("2") do |config|
67
67
  config.vm.provision :docker do |docker|
68
+ # If you just want to pull in some base images
68
69
  docker.pull_images 'ubuntu', 'busybox'
69
70
 
70
71
  # Command + image
@@ -76,7 +77,11 @@ Vagrant.configure("2") do |config|
76
77
  # Base image (requires ENTRYPOINT / CMD) to be configured:
77
78
  # * http://docs.docker.io/en/latest/use/builder/#entrypoint
78
79
  # * http://docs.docker.io/en/latest/use/builder/#cmd
79
- docker.run 'mysql'
80
+ docker.run 'user/mysql'
81
+
82
+ # If you need to go deeper, you can pass in additional `docker run` arguments
83
+ # Same as: docker run -v /host:/container -p 1234:3306 user/patched-mysql /usr/bin/mysql
84
+ docker.run mysql: { additional_run_args: '-v /host:/container -p 1234:3306', image: 'user/patched-mysql', cmd: '/usr/bin/mysql'}
80
85
  end
81
86
  end
82
87
  ```
@@ -19,18 +19,12 @@ Vagrant.configure("2") do |config|
19
19
  lxc.customize 'aa_profile', 'unconfined'
20
20
  end
21
21
 
22
+ # Required to boot nested containers
22
23
  config.vm.provision :shell, inline: %[
23
24
  if ! [ -f /etc/default/lxc ]; then
24
25
  cat <<STR > /etc/default/lxc
25
- LXC_AUTO="true"
26
- USE_LXC_BRIDGE="true"
27
- LXC_BRIDGE="lxcbr0"
28
- LXC_ADDR="10.0.253.1"
29
- LXC_NETMASK="255.255.255.0"
30
- LXC_NETWORK="10.0.253.0/24"
31
- LXC_DHCP_RANGE="10.0.253.2,10.0.253.254"
32
- LXC_DHCP_MAX="253"
33
- LXC_SHUTDOWN_TIMEOUT=120
26
+ LXC_AUTO="false"
27
+ USE_LXC_BRIDGE="false"
34
28
  STR
35
29
  fi
36
30
  ]
@@ -38,9 +32,9 @@ STR
38
32
  config.vm.define :vm1 do |vm1|
39
33
  vm1.vm.provision :docker do |docker|
40
34
  docker.pull_images 'ubuntu', 'busybox'
41
- docker.run 'echo ls -la --color', 'ubuntu'
42
- docker.run 'echo ls -la --color', image: 'ubuntu' # Above is the default
43
- docker.run 'date', image: 'ubuntu', cmd: '/bin/sh -c "while true; date; do echo hello world; sleep 1; done"'
35
+ docker.run 'echo ls -la --color', 'busybox'
36
+ docker.run 'echo ls -la --color', image: 'busybox' # Above is the default
37
+ docker.run 'date', additional_run_args: '-p 1234:562', image: 'busybox', cmd: '/bin/sh -c "while true; date; do echo hello world; sleep 1; done"'
44
38
  end
45
39
  end
46
40
 
@@ -0,0 +1,14 @@
1
+ module VagrantPlugins
2
+ module Vocker
3
+ module Cap
4
+ module Debian
5
+ module DockerConfigureVagrantUser
6
+ def self.docker_configure_vagrant_user(machine)
7
+ # FIXME: We should make use of the config.ssh.username here
8
+ machine.communicate.sudo("usermod -a -G docker vagrant")
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ module VagrantPlugins
2
+ module Vocker
3
+ module Cap
4
+ module Debian
5
+ module DockerStartService
6
+ def self.docker_start_service(machine)
7
+ machine.communicate.sudo("service docker start")
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -15,6 +15,12 @@ module VagrantPlugins
15
15
  end
16
16
  end
17
17
 
18
+ def start_service
19
+ if !daemon_running? && @machine.guest.capability?(:docker_start_service)
20
+ @machine.guest.capability(:docker_start_service)
21
+ end
22
+ end
23
+
18
24
  def daemon_running?
19
25
  @machine.communicate.test('test -f /var/run/docker.pid')
20
26
  end
@@ -58,6 +64,7 @@ module VagrantPlugins
58
64
  def create_container(config)
59
65
  args = "-cidfile=#{config[:cidfile]} -d"
60
66
  args << " -dns=#{config[:dns]}" if config[:dns]
67
+ args << " #{config[:additional_run_args]}" if config[:additional_run_args]
61
68
  @machine.communicate.sudo %[
62
69
  rm -f #{config[:cidfile]}
63
70
  docker run #{args} #{config[:image]} #{config[:cmd]}
@@ -30,6 +30,10 @@ module VagrantPlugins
30
30
  else
31
31
  @machine.env.ui.warn I18n.t('vagrant.docker_auto_start_not_available')
32
32
  end
33
+
34
+ if @machine.guest.capability?(:docker_configure_vagrant_user)
35
+ @machine.guest.capability(:docker_configure_vagrant_user)
36
+ end
33
37
  end
34
38
  end
35
39
  end
@@ -26,6 +26,16 @@ module VagrantPlugins
26
26
  Cap::Debian::DockerConfigureAutoStart
27
27
  end
28
28
 
29
+ guest_capability("debian", "docker_configure_vagrant_user") do
30
+ require_relative "cap/debian/docker_configure_vagrant_user"
31
+ Cap::Debian::DockerConfigureVagrantUser
32
+ end
33
+
34
+ guest_capability("debian", "docker_start_service") do
35
+ require_relative "cap/debian/docker_start_service"
36
+ Cap::Debian::DockerStartService
37
+ end
38
+
29
39
  guest_capability("linux", "docker_installed") do
30
40
  require_relative "cap/linux/docker_installed"
31
41
  Cap::Linux::DockerInstalled
@@ -19,6 +19,8 @@ module VagrantPlugins
19
19
  @logger.info("Checking for Docker installation...")
20
20
  @installer.ensure_installed
21
21
 
22
+ # Attempt to start service if not running
23
+ @client.start_service
22
24
  unless @client.daemon_running?
23
25
  raise Errors::DockerNotRunning
24
26
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Vocker
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
@@ -56,6 +56,13 @@ describe VagrantPlugins::Vocker::DockerClient do
56
56
  expect(communicator).to have_received.sudo(with{|cmd| cmd =~ /-dns=127\.0\.0\.1/})
57
57
  end
58
58
 
59
+ it 'allows additional params to be passed to the run command if specified' do
60
+ stub(communicator).test(with{|cmd| cmd =~ /docker ps/}) { false }
61
+ containers['mysql'][:additional_run_args] = '-p 49176:5601 -p 49175:514'
62
+ subject.run containers
63
+ expect(communicator).to have_received.sudo(with{|cmd| cmd =~ /-p 49176:5601 -p 49175:514/})
64
+ end
65
+
59
66
  context 'when the container already exists' do
60
67
  before do
61
68
  stub(communicator).test(with{|cmd| cmd =~ /docker ps -a -q/}) { true }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vocker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Rehm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-03 00:00:00.000000000 Z
11
+ date: 2013-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,7 +58,9 @@ files:
58
58
  - development/Vagrantfile
59
59
  - lib/vocker.rb
60
60
  - lib/vocker/cap/debian/docker_configure_auto_start.rb
61
+ - lib/vocker/cap/debian/docker_configure_vagrant_user.rb
61
62
  - lib/vocker/cap/debian/docker_install.rb
63
+ - lib/vocker/cap/debian/docker_start_service.rb
62
64
  - lib/vocker/cap/linux/docker_installed.rb
63
65
  - lib/vocker/command.rb
64
66
  - lib/vocker/config.rb
@@ -96,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
98
  version: '0'
97
99
  requirements: []
98
100
  rubyforge_project:
99
- rubygems_version: 2.0.7
101
+ rubygems_version: 2.1.5
100
102
  signing_key:
101
103
  specification_version: 4
102
104
  summary: Introduces Docker to Vagrant