From 6096bb299b5ea1d80776111b46f24d6e082c9745 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Fri, 12 May 2017 06:46:31 -0700 Subject: [PATCH] Only set image if option given. Do not apply when setting build options. --- plugins/providers/docker/driver/compose.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/providers/docker/driver/compose.rb b/plugins/providers/docker/driver/compose.rb index dbdf91567..a2d833a23 100644 --- a/plugins/providers/docker/driver/compose.rb +++ b/plugins/providers/docker/driver/compose.rb @@ -1,5 +1,3 @@ -# NOTE: DETACHED - require "json" require "log4r" @@ -37,7 +35,7 @@ module VagrantPlugins name = machine.name.to_s @logger.debug("Applying build for `#{name}` using `#{dir}` directory.") begin - update_composition(:apply) do |composition| + update_composition do |composition| services = composition["services"] ||= {} services[name] ||= {} services[name]["build"] = {"context" => dir} @@ -103,7 +101,6 @@ module VagrantPlugins ) end services[name].merge!( - "image" => image, "environment" => env, "expose" => expose, "ports" => ports, @@ -111,6 +108,7 @@ module VagrantPlugins "links" => links, "command" => cmd ) + services[name]["image"] = image if image services[name]["hostname"] = params[:hostname] if params[:hostname] services[name]["privileged"] = true if params[:privileged] services[name]["pty"] = true if params[:pty]