class Docr::Endpoints::Containers

Overview

Class responsible for handling container operations in the Docr system.

Defined in:

docr/endpoints/containers.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(client : Docr::Client) #

Initializes a new Containers instance with the provided client.


[View source]

Instance Method Detail

def attach(id : String) #

Attach to a container

  • id: ID of the container to attach to.

[View source]
def changes(id : String) : Array(Docr::Types::ContainerChangeResponseItem) #

Fetches the changes made to the container.

  • id: ID of the container.

Returns an array of container change items.


[View source]
def client : Docr::Client #

[View source]

Creates a new container.

  • name: Name of the container.
  • config: Configuration for creating the container.

Returns a response containing information about the created container.


[View source]
def delete(id : String, volumes = false, force = false, link = false) #

Deletes a specific container.

  • id: ID of the container to delete.
  • volumes: If true, remove associated volumes. Default is false.
  • force: If true, force deletion. Default is false.
  • link: If true, remove the link. Default is false.

[View source]
def inspect(id : String) : Docr::Types::ContainerInspectResponse #

Inspects a specific container.

  • id: ID of the container to inspect.

Returns detailed information about the container.


[View source]
def kill(id : String, signal = "SIGKILL") #

Kills a specific container.

  • id: ID of the container to kill.
  • signal: Signal to use for killing. Default is "SIGKILL".

[View source]
def list(all : Bool = false, limit : Int32 | Nil = nil, size : Bool = false, filters = Hash(String, Array(String)).new) : Array(Docr::Types::ContainerSummary) #

Fetches a list of containers.

  • all: If true, list all containers. Default is false.
  • limit: The maximum number of containers to list.
  • size: If true, fetch container sizes. Default is false.
  • filters: Container filter criteria. Default is an empty hash.

Returns an array of container summaries.


[View source]
def logs(id : String, follow = false, stdout = false, stderr = false, since = 0, _until = 0, timestamps = false, tail = "all") #

Fetches logs of a specific container.

  • id: ID of the container.
  • follow: If true, follow logs. Default is false.
  • stdout: If true, fetch stdout logs. Default is false.
  • stderr: If true, fetch stderr logs. Default is false.
  • since: Timestamp to start showing logs. Default is 0.
  • until: Timestamp to stop showing logs. Default is 0.
  • timestamps: If true, include timestamps. Default is false.
  • tail: Number of lines to show from the end of the logs. Default is "all".

Returns the IO stream of the logs.


[View source]
def pause(id : String) #

Pauses a specific container.

  • id: ID of the container to pause.

[View source]
def restart(id : String) #

Restarts a specific container.

  • id: ID of the container to restart.

[View source]
def start(id : String) #

Starts a specific container.

  • id: ID of the container to start.

[View source]
def stop(id : String) #

Stops a specific container.

  • id: ID of the container to stop.

[View source]
def top(id : String, ps_args = "-ef") : Docr::Types::ContainerTopResponse #

Fetches process details within a specific container.

  • id: ID of the container.
  • ps_args: Arguments for the ps command. Default is "-ef".

Returns process details within the container.


[View source]
def unpause(id : String) #

Unpauses a specific container.

  • id: ID of the container to unpause.

[View source]
def wait(id : String, condition = "not-running") : Docr::Types::ContainerWaitResponse #

Waits for a container to reach a specific condition.

  • id: ID of the container to wait for.
  • condition: Wait condition. Default is "not-running".

Returns information about the waited container.


[View source]