Method: Default#sh

Defined in:
lib/dockit/cli.rb

#sh(service = nil, *cmd) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/dockit/cli.rb', line 92

def sh(service=nil, *cmd)
  exec(service) do |s|
    cmd = %w[bash -l] if cmd.length < 1

    # in case image has an entrypoint, use the cmd as the entrypoint
    (entrypoint, *cmd) = cmd
    s.start(
      transient: true,
      verbose: options.verbose,
      create: {
        Entrypoint: [entrypoint],
        Cmd: cmd,
        name: 'sh',
        Tty: true,
        AttachStdin: true,
        AttachStdout: true,
        AttachStderr: true,
        OpenStdin: true,
        StdinOnce: true,
      })
  end
end