From 6b47e363bc067c9d9632015eef8853fcbddd59ae Mon Sep 17 00:00:00 2001 From: Vasu1105 Date: Tue, 9 Mar 2021 14:10:19 +0530 Subject: [PATCH 1/2] Handle user option for user selection through docker transport Signed-off-by: Vasu1105 --- lib/train/transports/docker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/train/transports/docker.rb b/lib/train/transports/docker.rb index 9b2cb54e7..99a0cd60c 100644 --- a/lib/train/transports/docker.rb +++ b/lib/train/transports/docker.rb @@ -88,7 +88,7 @@ def run_command_via_connection(cmd, &_data_handler) stdout, stderr, exit_status = @container.exec( [ "/bin/sh", "-c", cmd - ] + ], user: @options[:user] ) CommandResult.new(stdout.join, stderr.join, exit_status) rescue ::Docker::Error::DockerError => _ From b6da8492f76cb7e48013ac3708a26d7394f15eec Mon Sep 17 00:00:00 2001 From: Vasu1105 Date: Wed, 10 Mar 2021 11:51:22 +0530 Subject: [PATCH 2/2] Updated README for docker transport user option Signed-off-by: Vasu1105 --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 0e7f74e78..132f26f93 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,12 @@ train = Train.create('winrm', require 'train' train = Train.create('docker', host: 'container_id...') ``` +You can use `user` option to connect with privileged user on non root user images. + +```ruby +require 'train' +train = Train.create('docker', host: 'container_id...', user: 'root') +``` **AWS**