diff --git a/README.md b/README.md index 0e7f74e7..132f26f9 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** diff --git a/lib/train/transports/docker.rb b/lib/train/transports/docker.rb index 9b2cb54e..99a0cd60 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 => _