From 8688c6b8b23a71acd934b03a09c95ccd166c1e3a Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Thu, 5 Dec 2013 22:12:44 -0200 Subject: [PATCH 1/3] provisioners/docker: Only assign the `image` config in case it was not specified --- plugins/provisioners/docker/config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/provisioners/docker/config.rb b/plugins/provisioners/docker/config.rb index 362e442db..078804974 100644 --- a/plugins/provisioners/docker/config.rb +++ b/plugins/provisioners/docker/config.rb @@ -22,7 +22,7 @@ module VagrantPlugins def run(name, **options) params = options.dup - params[:image] = name + params[:image] ||= name # TODO: Validate provided parameters before assignment @containers[name.to_s] = params From bdd4e82e49ab168d16d3f38eb305ec7d76450a82 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Thu, 5 Dec 2013 22:13:46 -0200 Subject: [PATCH 2/3] website/docs: Add an example on how to run multiple containers based off the same image --- website/docs/source/v2/provisioning/docker.html.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/website/docs/source/v2/provisioning/docker.html.md b/website/docs/source/v2/provisioning/docker.html.md index c35cc8dca..69edb7b38 100644 --- a/website/docs/source/v2/provisioning/docker.html.md +++ b/website/docs/source/v2/provisioning/docker.html.md @@ -110,3 +110,15 @@ Vagrant.configure("2") do |config| end end ``` + +In case you need to run multiple containers based off the same image, you can do +so by providing different names and specifying the `image` parameter to it: + +```ruby +Vagrant.configure("2") do |config| + config.vm.provision "docker" do |d| + d.run "db-1", image: "user/mysql" + d.run "db-2", image: "user/mysql" + end +end +``` From 6d7a2fe113542c573ec1ea1b1901738369e75ce0 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Thu, 5 Dec 2013 22:14:57 -0200 Subject: [PATCH 3/3] website/docs: Add some links to Docker provisioner page --- website/docs/source/v2/provisioning/docker.html.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/website/docs/source/v2/provisioning/docker.html.md b/website/docs/source/v2/provisioning/docker.html.md index 69edb7b38..97ab11c64 100644 --- a/website/docs/source/v2/provisioning/docker.html.md +++ b/website/docs/source/v2/provisioning/docker.html.md @@ -92,11 +92,11 @@ to the name, the `run` method accepts a set of options, all optional: but can also be given here as an option. * `cmd` (string) - The command to start within the container. If not specified, - then the containers default "run" command will be used, such as the - "run" command specified when the container was built. + then the container's default "run" command will be used, such as the + "run" command [specified on the `Dockerfile`](http://docs.docker.io/en/latest/use/builder/#run). -* `args` (string) - Extra arguments for `docker run` on the command line. - These are raw arguments that are passed directly to Docker. +* `args` (string) - Extra arguments for [`docker run`](http://docs.docker.io/en/latest/commandline/cli/#run) + on the command line. These are raw arguments that are passed directly to Docker. For example, here is how you would configure Docker to run a container with the Vagrant shared directory mounted inside of it: