package docker-api

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type port = {
  1. priv : int;
    (*

    Private port number.

    *)
  2. pub : int;
    (*

    Public port number.

    *)
  3. typ : string;
    (*

    Type, e.g., "tcp".

    *)
}
type id = string
type t = {
  1. id : id;
    (*

    Identifier of the container.

    *)
  2. names : string list;
    (*

    Names given to the container.

    *)
  3. image : string;
    (*

    Name of the image used to create the container.

    *)
  4. command : string;
    (*

    Command passed to the container.

    *)
  5. created : float;
    (*

    Unix time of creation.

    *)
  6. status : string;
    (*

    Human readable status.

    *)
  7. ports : port list;
  8. size_rw : int;
  9. size_root_fs : int;
}
type bind =
  1. | Vol of string
    (*

    create a new volume for the container

    *)
  2. | Mount of string * string
    (*

    Mount(host_path, container_path) bind-mount a host path into the container. A relative host_path will be interpreted as relative to the current working directory (at the time of the function calling this binding).

    *)
  3. | Mount_ro of string * string
    (*

    As Mount but make the bind-mount read-only inside the container.

    *)
val list : ?addr:Unix.sockaddr -> ?all:bool -> ?limit:int -> ?since:id -> ?before:id -> ?size:bool -> unit -> t list

list () lists running containers (or all containers if ~all is set to true).

  • parameter all

    Show all containers. Only running containers are shown by default (i.e., this defaults to false).

val create : ?addr:Unix.sockaddr -> ?hostname:string -> ?domainname:string -> ?user:string -> ?memory:int -> ?memory_swap:int -> ?stdin:bool -> ?stdout:bool -> ?stderr:bool -> ?open_stdin:bool -> ?stdin_once:bool -> ?env:string list -> ?workingdir:string -> ?networking:bool -> ?binds:bind list -> ?name:string -> string -> string list -> id

create image cmd create a container and returns its ID where image is the image name to use for the container and cmd the command to run. cmd has the form [prog; arg1;...; argN]. BEWARE that the output of cmd (on stdout and stderr) will be logged by the container (see logs) so it will consume disk space.

  • parameter hostname

    the desired hostname to use for the container.

  • parameter domainname

    the desired domain name to use for the container.

  • parameter user

    the user (or UID) to use inside the container.

  • parameter memory

    Memory limit in bytes.

  • parameter memory_swap

    Total memory usage (memory + swap); set -1 to disable swap.

  • parameter stdin

    Attaches to stdin (default false).

  • parameter stdout

    Attaches to stdout (default true).

  • parameter stdout

    Attaches to stderr (default true).

  • parameter open_stdin

    opens stdin (sic).

  • parameter stdin_once

    Close stdin after the 1 attached client disconnects. Default: false.

  • parameter env

    A list of environment variables of the form "VAR=value".

  • parameter workingdir

    The working dir for commands to run in.

  • parameter networking

    Whether networking is enabled for the container. Default: false.

  • parameter binds

    A list of volume bindings for this container.

  • parameter name

    The name of the container. The name must match /?[a-zA-Z0-9_-]+ or Invalid_argument is raised. It can be used in place of the container ID. If the name exists (whether the container is running or not), the container will not be recreated. Note that the corresponding name in t (as obtained by list) will have an initial '/' which means that the socker daemon is the parent container.

changes conn id Inspect changes on container id's filesystem.

export conn id export the contents of container id.

val start : ?addr:Unix.sockaddr -> ?binds:bind list -> id -> unit

start id starts the container id. BEWARE that the optinal arguments set here override the corresponding ones of create.

  • raises Server_error

    when, for example, if the command given by create does not exist in the container.

  • parameter binds

    directories shared between the host and the container. Each has the form (host_dir, container_dir, access).

val stop : ?addr:Unix.sockaddr -> ?wait:int -> id -> unit

stop id stops the container id.

  • parameter wait

    number of seconds to wait before killing the container.

val restart : ?addr:Unix.sockaddr -> ?wait:int -> id -> unit

restart id restart the container id.

  • parameter wait

    number of seconds to wait before killing the container.

val kill : ?addr:Unix.sockaddr -> ?signal:int -> id -> unit

kill id kill the container id.

  • parameter signal

    Signal to send to the container (see the standard module Sys). When not set, Sys.sigkill is assumed and the call will waits for the container to exit.

val pause : ?addr:Unix.sockaddr -> id -> unit

pause id pause the container id.

val unpause : ?addr:Unix.sockaddr -> id -> unit

unpause id unpause the container id.

val attach : ?addr:Unix.sockaddr -> ?logs:bool -> ?stream:bool -> ?stdin:bool -> ?stdout:bool -> ?stderr:bool -> id -> Stream.t

attach id view or interact with any running container id primary process (pid 1).

  • parameter logs

    Return logs. Default false.

  • parameter stream

    Return stream. Default false.

  • parameter stdin

    If stream=true, attach to stdin. Default false.

  • parameter stdout

    If logs=true, return stdout log, if stream=true, attach to stdout. Default false.

  • parameter stderr

    If logs=true, return stderr log, if stream=true, attach to stderr. Default false.

val rm : ?addr:Unix.sockaddr -> ?volumes:bool -> ?force:bool -> id -> unit

rm id remove the container id from the filesystem.

  • parameter volumes

    Remove the volumes associated to the container. Default false.

  • parameter force

    Kill then remove the container. Default false.

module Exec : sig ... end