Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle user option for user selection through docker transport #669

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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