Docker.Containertype t = {id : id; | (* Identifier of the container. *) |
names : string list; | (* Names given to the container. *) |
image : string; | (* Name of the image used to create the container. *) |
command : string; | (* Command passed to the container. *) |
created : float; | (* Unix time of creation. *) |
status : string; | (* Human readable status. *) |
ports : port list; | |
size_rw : int option; | |
size_root_fs : int option; |
}type bind = val list :
?addr:Unix.sockaddr ->
?all:bool ->
?limit:int ->
?size:bool ->
?before:id_or_name ->
?exited:int list ->
?health:[ `Starting | `Healthy | `Unhealthy | `None ] list ->
?name:string list ->
?since:id_or_name ->
?status:
[ `Created
| `Restarting
| `Running
| `Removing
| `Paused
| `Exited
| `Dead ]
list ->
?volume:string ->
unit ->
t listlist () lists running containers (or all containers if ~all is set to true).
type host_config = {cpu_shares : int; | (* Represents this container's relative CPU weight versus other containers. Non-positive values are ignored. *) |
memory : int; | (* Memory limit in bytes. *) |
cgroup_parent : string; | (* Path to cgroups under which the container's cgroup is created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups are created if they do not already exist. *) |
blk_io_weight : int; | (* Block IO weight (relative weight). Values outside |
cpu_period : int; | (* The length of a CPU period in microseconds. Non-positive values do not set this field. *) |
memory_swap : int; | (* Total memory limit (memory + swap). Set as -1 to enable unlimited swap. *) |
binds : bind list; | (* A list of volume bindings for this container. *) |
network_mode : string; | (* Network mode to use for this container. Supported standard values are: bridge, host, none, and container:<name|id>. Any other value is taken as a custom network's name to which this container should connect to. *) |
policy : [ `None
| `Auto_remove
| `Restart_always
| `Restart_unless_stopped
| `Restart_on_failure of int ]; | (* The behavior to apply when the container exits. The default is not to restart and not to remove the container (
|
}val host :
?cpu_shares:int ->
?memory:int ->
?cgroup_parent:string ->
?blk_io_weight:int ->
?cpu_period:int ->
?memory_swap:int ->
?binds:bind list ->
?network_mode:string ->
?policy:
[ `Auto_remove
| `None
| `Restart_always
| `Restart_on_failure of int
| `Restart_unless_stopped ] ->
unit ->
host_configReturn the default host configuration changed according to which optional labels were set.
val create :
?addr:Unix.sockaddr ->
?hostname:string ->
?domainname:string ->
?user:string ->
?stdin:bool ->
?stdout:bool ->
?stderr:bool ->
?open_stdin:bool ->
?stdin_once:bool ->
?env:string list ->
?workingdir:string ->
?networking:bool ->
?host:host_config ->
?name:string ->
string ->
string list ->
idcreate 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.
val changes :
?addr:Unix.sockaddr ->
id ->
(string * [ `Modified | `Added | `Deleted ]) listchanges conn id returns which files in a container's filesystem have been added, deleted, or modified.
export conn id export the contents of container id.
val start : ?addr:Unix.sockaddr -> ?detach_keys:string -> id -> unitstart id starts the container id.
val stop : ?addr:Unix.sockaddr -> ?wait:int -> id -> unitstop id stops the container id.
val wait : ?addr:Unix.sockaddr -> id -> intwait id block until a container id stops, then returns the exit code.
val restart : ?addr:Unix.sockaddr -> ?wait:int -> id -> unitrestart id restart the container id.
val kill : ?addr:Unix.sockaddr -> ?signal:int -> id -> unitkill id kill the container id.
val pause : ?addr:Unix.sockaddr -> id -> unitpause id pause the container id.
val unpause : ?addr:Unix.sockaddr -> id -> unitunpause id unpause the container id.
val attach :
?addr:Unix.sockaddr ->
?stdin:bool ->
?stdout:bool ->
?stderr:bool ->
id ->
[ `Logs | `Stream | `Logs_and_stream ] ->
Stream.tattach id what view or interact with any running container id primary process (pid 1).
what = `Logs replay the logs from the container: you will get the output since the container started.what = `Stream, stream stdin, stdout and stderr (if enabled) from the time the request was made onwards.what = `Logs_and_stream after getting the output of `Logs, it will seamlessly transition into streaming current output.val rm :
?addr:Unix.sockaddr ->
?volumes:bool ->
?force:bool ->
?link:bool ->
id ->
unitrm id remove the container id from the filesystem.
module Exec : sig ... end