From e90e45a8fb27d7c28771017cfdfc173cf43ab421 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 29 Apr 2014 15:51:32 -0700 Subject: [PATCH] providers/docker: pty flag, not functional yet --- plugins/providers/docker/action/create.rb | 4 ++++ plugins/providers/docker/command/run.rb | 9 ++++++++- plugins/providers/docker/driver.rb | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/providers/docker/action/create.rb b/plugins/providers/docker/action/create.rb index fe747e52d..3068d3b58 100644 --- a/plugins/providers/docker/action/create.rb +++ b/plugins/providers/docker/action/create.rb @@ -26,6 +26,9 @@ module VagrantPlugins # No ports should be shared to the host params[:ports] = [] + # Allocate a pty if it was requested + params[:pty] = true if env[:run_pty] + # We link to our original container # TODO end @@ -94,6 +97,7 @@ module VagrantPlugins name: container_name, ports: forwarded_ports, privileged: @provider_config.privileged, + pty: false, volumes: @provider_config.volumes, } end diff --git a/plugins/providers/docker/command/run.rb b/plugins/providers/docker/command/run.rb index 4de85dd76..25a5d786e 100644 --- a/plugins/providers/docker/command/run.rb +++ b/plugins/providers/docker/command/run.rb @@ -9,6 +9,7 @@ module VagrantPlugins def execute options = {} options[:detach] = false + options[:pty] = false opts = OptionParser.new do |o| o.banner = "Usage: vagrant docker-run [command...]" @@ -19,6 +20,10 @@ module VagrantPlugins o.on("--[no-]detach", "Run in the background") do |d| options[:detach] = d end + + o.on("-t", "--[no-]tty", "Allocate a pty") do |t| + options[:pty] = t + end end # Parse out the extra args to send to SSH, which is everything @@ -41,7 +46,9 @@ module VagrantPlugins machine.action( :run_command, run_command: command, - run_detach: options[:detach]) + run_detach: options[:detach], + run_pty: options[:pty], + ) end 0 diff --git a/plugins/providers/docker/driver.rb b/plugins/providers/docker/driver.rb index a85f3e559..3661b5522 100644 --- a/plugins/providers/docker/driver.rb +++ b/plugins/providers/docker/driver.rb @@ -44,6 +44,7 @@ module VagrantPlugins run_cmd += volumes.map { |v| ['-v', v.to_s] } run_cmd += %W(--privileged) if params[:privileged] run_cmd += %W(-h #{params[:hostname]}) if params[:hostname] + run_cmd << "-t" if params[:pty] run_cmd += params[:extra_args] if params[:extra_args] run_cmd += [image, cmd]