Class: Bsdkrun::DockerContainer
- Inherits:
-
Data
- Object
- Data
- Bsdkrun::DockerContainer
- Defined in:
- lib/bsdkrun/types.rb
Overview
A container in the Docker engine VM — a trimmed docker ps row.
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ports ⇒ Object
readonly
Returns the value of attribute ports.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
-
.from_graphql(c) ⇒ DockerContainer
(also: from_row)
Both the GraphQL object and
docker ps --jsonuse these field names.
Instance Method Summary collapse
-
#running? ⇒ Boolean
Whether the container is up.
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command
255 256 257 |
# File 'lib/bsdkrun/types.rb', line 255 def command @command end |
#created ⇒ Object (readonly)
Returns the value of attribute created
255 256 257 |
# File 'lib/bsdkrun/types.rb', line 255 def created @created end |
#id ⇒ Object (readonly)
Returns the value of attribute id
255 256 257 |
# File 'lib/bsdkrun/types.rb', line 255 def id @id end |
#image ⇒ Object (readonly)
Returns the value of attribute image
255 256 257 |
# File 'lib/bsdkrun/types.rb', line 255 def image @image end |
#name ⇒ Object (readonly)
Returns the value of attribute name
255 256 257 |
# File 'lib/bsdkrun/types.rb', line 255 def name @name end |
#ports ⇒ Object (readonly)
Returns the value of attribute ports
255 256 257 |
# File 'lib/bsdkrun/types.rb', line 255 def ports @ports end |
#state ⇒ Object (readonly)
Returns the value of attribute state
255 256 257 |
# File 'lib/bsdkrun/types.rb', line 255 def state @state end |
#status ⇒ Object (readonly)
Returns the value of attribute status
255 256 257 |
# File 'lib/bsdkrun/types.rb', line 255 def status @status end |
Class Method Details
.from_graphql(c) ⇒ DockerContainer Also known as: from_row
Both the GraphQL object and docker ps --json use these field names.
266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/bsdkrun/types.rb', line 266 def self.from_graphql(c) new( id: c["id"].to_s, name: c["name"].to_s, image: c["image"].to_s, command: (c["command"] || "").to_s, state: c["state"].to_s, status: c["status"].to_s, ports: Array(c["ports"]), created: c["created"].to_i ) end |
Instance Method Details
#running? ⇒ Boolean
Returns whether the container is up.
259 260 261 |
# File 'lib/bsdkrun/types.rb', line 259 def running? state == "running" end |