class Docker::Containers

Overview

Run and manage containers on the attached docker instance.

Included Modules

Defined in:

docker/containers.cr

Instance Method Summary

Constructor methods inherited from module Docker::ApiClientWrapper

new(client) new

Instance Method Detail

def 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.


[View source]
def get(id_or_name) #

Get a container by name or ID.


[View source]
def 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. [:tag], , 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.

[View source]