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 +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +2 -2
- data/README.md +6 -1
- data/development/Vagrantfile +6 -12
- data/lib/vocker/cap/debian/docker_configure_vagrant_user.rb +14 -0
- data/lib/vocker/cap/debian/docker_start_service.rb +13 -0
- data/lib/vocker/docker_client.rb +7 -0
- data/lib/vocker/docker_installer.rb +4 -0
- data/lib/vocker/plugin.rb +10 -0
- data/lib/vocker/provisioner.rb +2 -0
- data/lib/vocker/version.rb +1 -1
- data/spec/unit/docker_client_spec.rb +7 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01ebe4e117bf2353cbc0ce30465d58fcde38ab67
|
4
|
+
data.tar.gz: 4414a6eef3b96935e53ea2346676aa329e1d80a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b18a0828dc7f538e0d35d0832e71239a0d4c60ee596366d1050a4214947dc2ce7f43bb4f41fe9212d0b90af274da4897a3d9b675379543123586a962c7c8ca8
|
7
|
+
data.tar.gz: 53d6655eceab26f844e48c12c4aa4da9d578abef09a58a41ccdda58d16e6321e21e75f193253a18caedce57c91a8a0eab72d08b3a714de5fea3c95e9ccfb256c
|
data/CHANGELOG.md
CHANGED
@@ -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
|
data/Gemfile.lock
CHANGED
@@ -13,7 +13,7 @@ GIT
|
|
13
13
|
PATH
|
14
14
|
remote: .
|
15
15
|
specs:
|
16
|
-
vocker (0.3.
|
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.
|
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
|
```
|
data/development/Vagrantfile
CHANGED
@@ -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="
|
26
|
-
USE_LXC_BRIDGE="
|
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', '
|
42
|
-
docker.run 'echo ls -la --color', image: '
|
43
|
-
docker.run 'date', image: '
|
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
|
data/lib/vocker/docker_client.rb
CHANGED
@@ -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
|
data/lib/vocker/plugin.rb
CHANGED
@@ -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
|
data/lib/vocker/provisioner.rb
CHANGED
data/lib/vocker/version.rb
CHANGED
@@ -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.
|
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-
|
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.
|
101
|
+
rubygems_version: 2.1.5
|
100
102
|
signing_key:
|
101
103
|
specification_version: 4
|
102
104
|
summary: Introduces Docker to Vagrant
|