class

Docker::Containers

Inherits Docker::ApiClientWrapper / Reference / Object

Run and manage containers on the attached docker instance.

Instance methods

create(image : String, **props)

Create a container without starting it.

Similar to docker create.

Returns a Docker::Container that may be used to start, inspect or otherwise interact with the created container.

Source
get(id_or_name)

Get a container by name or ID.

Source
list(all : Bool | Nil = nil, limit : Int | Nil = nil, size : Bool | Nil = nil, filters : Hash | Nil = nil) : Array(Container)

List containers. Similar to the docker ps command.

Available filters, filter value may be a single value or an array:

  • exited : Int32 Only containers with specified exit code
  • status : String One of "restarting", "running", "paused", "exited"
  • label : String Format either "key" or "key=value"
  • id : String Container ID
  • name : String Container name
  • ancestor : String String Filter by container ancestor. <image-name>[:tag], <image-id>, image@digest.
  • before : String String Only containers created before a particular container. Container name or ID.
  • since : String Only containers created after a particular container. Container name or ID.
Source