Skip to content

Commit

Permalink
Merge pull request #669 from handle_user_option_in_docker_transport
Browse files Browse the repository at this point in the history
  • Loading branch information
clintoncwolfe authored Mar 10, 2021
2 parents d5b3c9a + b6da849 commit 3dbb4f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
2 changes: 1 addition & 1 deletion lib/train/transports/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 => _
Expand Down

0 comments on commit 3dbb4f8

Please sign in to comment.