Method: Docker::Exec.create
- Defined in:
- lib/docker/exec.rb
.create(options = {}, conn = Docker.connection) ⇒ Docker::Exec
Create a new Exec instance in a running container. Please note, this does NOT execute the instance - you must run #start. Also, each instance is one-time use only.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/docker/exec.rb', line 20 def self.create( = {}, conn = Docker.connection) container = .delete('Container') # Podman does not attach these by default but does require them to be attached if ::Docker.podman? ['AttachStderr'] = true if ['AttachStderr'].nil? ['AttachStdout'] = true if ['AttachStdout'].nil? end resp = conn.post("/containers/#{container}/exec", {}, body: MultiJson.dump()) hash = Docker::Util.parse_json(resp) || {} new(conn, hash) end |