Skip to content

docker

docker documentation

footman._stubs.docker.Docker

Bases: Tool

__call__

__call__(
    *args: str,
    config: _Value = ...,
    context: _Value = ...,
    debug: _Flag = ...,
    host: _Value = ...,
    log_level: _Value = ...,
    tls: _Flag = ...,
    tlscacert: _Value = ...,
    tlscert: _Value = ...,
    tlskey: _Value = ...,
    tlsverify: _Flag = ...,
    **flags: Any,
) -> Result

A self-sufficient runtime for containers

Parameters:

Name Type Description Default
config _Value

Location of client config files. Defaults to /Users/willem/.docker.

...
context _Value

Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with "docker context use").

...
debug _Flag

Enable debug mode.

...
host _Value

Daemon socket to connect to.

...
log_level _Value

Set the logging level ("debug", "info", "warn", "error", "fatal"). Defaults to info.

...
tls _Flag

Use TLS; implied by --tlsverify.

...
tlscacert _Value

Trust certs signed only by this CA. Defaults to /Users/willem/.docker/ca.pem.

...
tlscert _Value

Path to TLS certificate file. Defaults to /Users/willem/.docker/cert.pem.

...
tlskey _Value

Path to TLS key file. Defaults to /Users/willem/.docker/key.pem.

...
tlsverify _Flag

Use TLS and verify the remote.

...

build

build(
    path: str,
    /,
    *args: str,
    add_host: _Value = ...,
    allow: _Value = ...,
    annotation: _Value = ...,
    attest: _Value = ...,
    build_arg: _Value = ...,
    build_context: _Value = ...,
    builder: _Value = ...,
    cache_from: _Value = ...,
    cache_to: _Value = ...,
    call: _Value = ...,
    cgroup_parent: _Value = ...,
    check: _Flag = ...,
    debug: _Flag = ...,
    file: _Value = ...,
    iidfile: _Value = ...,
    label: _Value = ...,
    load: _Flag = ...,
    metadata_file: _Value = ...,
    network: _Value = ...,
    no_cache: _Flag = ...,
    no_cache_filter: _Value = ...,
    output: _Value = ...,
    platform: _Value = ...,
    policy: _Value = ...,
    progress: _Value = ...,
    provenance: _Value = ...,
    pull: _Flag = ...,
    push: _Flag = ...,
    quiet: _Flag = ...,
    resource: _Value = ...,
    sbom: _Value = ...,
    secret: _Value = ...,
    shm_size: _Value = ...,
    ssh: _Value = ...,
    tag: _Value = ...,
    target: _Value = ...,
    ulimit: _Value = ...,
    **flags: Any,
) -> Result

Start a build

Parameters:

Name Type Description Default
add_host _Value

Add a custom host-to-IP mapping (format: "host:ip").

...
allow _Value

Allow extra privileged entitlement (e.g., "network.host", "security.insecure", "device", "buildx.local.delete"). May be repeated: a list emits the flag once per item.

...
annotation _Value

Add annotation to the image. May be repeated: a list emits the flag once per item.

...
attest _Value

Attestation parameters (format: "type=sbom,generator=image"). May be repeated: a list emits the flag once per item.

...
build_arg _Value

Set build-time variables. May be repeated: a list emits the flag once per item.

...
build_context _Value

Additional build contexts (e.g., name=path). May be repeated: a list emits the flag once per item.

...
builder _Value

Override the configured builder instance. Defaults to desktop-linux.

...
cache_from _Value

External cache sources (e.g., "user/app:cache", "type=local,src=path/to/dir"). May be repeated: a list emits the flag once per item.

...
cache_to _Value

Cache export destinations (e.g., "user/app:cache", "type=local,dest=path/to/dir"). May be repeated: a list emits the flag once per item.

...
call _Value

Set method for evaluating build ("check", "outline", "targets"). Defaults to build.

...
cgroup_parent _Value

Set the parent cgroup for the "RUN" instructions during build.

...
check _Flag

Shorthand for "--call=check".

...
debug _Flag

Enable debug logging.

...
file _Value

Name of the Dockerfile. Defaults to PATH/Dockerfile.

...
iidfile _Value

Write the image ID to a file.

...
label _Value

Set metadata for an image. May be repeated: a list emits the flag once per item.

...
load _Flag

Shorthand for "--output=type=docker".

...
metadata_file _Value

Write build result metadata to a file.

...
network _Value

Set the networking mode for the "RUN" instructions during build. Defaults to default.

...
no_cache _Flag

Do not use cache when building the image.

...
no_cache_filter _Value

Do not cache specified stages. May be repeated: a list emits the flag once per item.

...
output _Value

Output destination (format: "type=local,dest=path"). May be repeated: a list emits the flag once per item.

...
platform _Value

Set target platform for build. May be repeated: a list emits the flag once per item.

...
policy _Value

Policy configuration (format: "filename=path[,filename=path][,reset=true|false][,disabled=true|false][,strict=true|false][,log-level=level]"). May be repeated: a list emits the flag once per item.

...
progress _Value

Set type of progress output ("auto", "none", "plain", "quiet", "rawjson", "tty"). Defaults to auto.

...
provenance _Value

Shorthand for "--attest=type=provenance".

...
pull _Flag

Always attempt to pull all referenced images.

...
push _Flag

Shorthand for "--output=type=registry,unpack=false".

...
quiet _Flag

Suppress the build output and print image ID on success.

...
resource _Value

Resource limits for build containers (format: "memory=2g", "cpu-quota=50000"). May be repeated: a list emits the flag once per item.

...
sbom _Value

Shorthand for "--attest=type=sbom".

...
secret _Value

Secret to expose to the build (format: "id=mysecret[,src=/local/secret]"). May be repeated: a list emits the flag once per item.

...
shm_size _Value

Shared memory size for build containers.

...
ssh _Value

SSH agent socket or keys to expose to the build (format: "default|[=|[,]]"). May be repeated: a list emits the flag once per item.

...
tag _Value

Image identifier (format: "[registry/]repository[:tag]"). May be repeated: a list emits the flag once per item.

...
target _Value

Set the target build stage to build.

...
ulimit _Value

Ulimit options. Defaults to [].

...

exec

exec(
    container: str,
    /,
    *args: str,
    detach: _Flag = ...,
    detach_keys: _Value = ...,
    env: _Value = ...,
    env_file: _Value = ...,
    interactive: _Flag = ...,
    privileged: _Flag = ...,
    tty: _Flag = ...,
    user: _Value = ...,
    workdir: _Value = ...,
    **flags: Any,
) -> Result

Execute a command in a running container

Parameters:

Name Type Description Default
detach _Flag

Detached mode: run command in the background.

...
detach_keys _Value

Override the key sequence for detaching a container.

...
env _Value

Set environment variables.

...
env_file _Value

Read in a file of environment variables.

...
interactive _Flag

Keep STDIN open even if not attached.

...
privileged _Flag

Give extended privileges to the command.

...
tty _Flag

Allocate a pseudo-TTY.

...
user _Value

Username or UID (format: "[:]").

...
workdir _Value

Working directory inside the container.

...

flags

flags(
    *,
    config: _Value = ...,
    context: _Value = ...,
    debug: _Flag = ...,
    host: _Value = ...,
    log_level: _Value = ...,
    tls: _Flag = ...,
    tlscacert: _Value = ...,
    tlscert: _Value = ...,
    tlskey: _Value = ...,
    tlsverify: _Flag = ...,
    **flags: Any,
) -> Docker

Bind tool-level global options before the subcommand.

tools.docker.flags(host=...) puts a tool's own options ahead of the verb, where they belong.

images

images(
    *args: str,
    all: _Flag = ...,
    digests: _Flag = ...,
    filter: _Value = ...,
    format: _Value = ...,
    no_trunc: _Flag = ...,
    quiet: _Flag = ...,
    tree: _Flag = ...,
    **flags: Any,
) -> Result

List images

Parameters:

Name Type Description Default
all _Flag

Show all images.

...
digests _Flag

Show digests.

...
filter _Value

Filter output based on conditions provided.

...
format _Value

Format output using a custom template: 'table': Print output in table format with column headers (default) 'table TEMPLATE': Print output in table format using the given Go template 'json': Print in JSON format 'TEMPLATE': Print output using the given Go template.

...
no_trunc _Flag

Don't truncate output.

...
quiet _Flag

Only show image IDs.

...
tree _Flag

List multi-platform images as a tree (EXPERIMENTAL).

...

logs

logs(
    container: str,
    /,
    *args: str,
    details: _Flag = ...,
    follow: _Flag = ...,
    since: _Value = ...,
    tail: _Value = ...,
    timestamps: _Flag = ...,
    until: _Value = ...,
    **flags: Any,
) -> Result

Fetch the logs of a container

Parameters:

Name Type Description Default
details _Flag

Show extra details provided to logs.

...
follow _Flag

Follow log output.

...
since _Value

Show logs since timestamp (e.g.

...
tail _Value

Number of lines to show from the end of the logs. Defaults to all.

...
timestamps _Flag

Show timestamps.

...
until _Value

Show logs before a timestamp (e.g.

...

ps

ps(
    *,
    all: _Flag = ...,
    filter: _Value = ...,
    format: _Value = ...,
    last: _Value = ...,
    latest: _Flag = ...,
    no_trunc: _Flag = ...,
    quiet: _Flag = ...,
    size: _Flag = ...,
    **flags: Any,
) -> Result

List containers

Parameters:

Name Type Description Default
all _Flag

Show all containers.

...
filter _Value

Filter output based on conditions provided.

...
format _Value

Format output using a custom template: 'table': Print output in table format with column headers (default) 'table TEMPLATE': Print output in table format using the given Go template 'json': Print in JSON format 'TEMPLATE': Print output using the given Go template.

...
last _Value

Show n last created containers (includes all states). Defaults to -1.

...
latest _Flag

Show the latest created container (includes all states).

...
no_trunc _Flag

Don't truncate output.

...
quiet _Flag

Only display container IDs.

...
size _Flag

Display total file sizes.

...

pull

pull(
    name: str,
    /,
    *args: str,
    all_tags: _Flag = ...,
    platform: _Value = ...,
    quiet: _Flag = ...,
    **flags: Any,
) -> Result

Download an image from a registry

Parameters:

Name Type Description Default
all_tags _Flag

Download all tagged images in the repository.

...
platform _Value

Set platform if server is multi-platform capable.

...
quiet _Flag

Suppress verbose output.

...

push

push(
    name: str,
    /,
    *args: str,
    all_tags: _Flag = ...,
    platform: _Value = ...,
    quiet: _Flag = ...,
    **flags: Any,
) -> Result

Upload an image to a registry

Parameters:

Name Type Description Default
all_tags _Flag

Push all tags of an image to the repository.

...
platform _Value

Push a platform-specific manifest as a single-platform image to the registry.

...
quiet _Flag

Suppress verbose output.

...

run

run(
    image: str,
    /,
    *args: str,
    add_host: _Value = ...,
    annotation: _Value = ...,
    attach: _Value = ...,
    blkio_weight: _Value = ...,
    blkio_weight_device: _Value = ...,
    cap_add: _Value = ...,
    cap_drop: _Value = ...,
    cgroup_parent: _Value = ...,
    cgroupns: _Value = ...,
    cidfile: _Value = ...,
    cpu_period: _Value = ...,
    cpu_quota: _Value = ...,
    cpu_rt_period: _Value = ...,
    cpu_rt_runtime: _Value = ...,
    cpu_shares: _Value = ...,
    cpus: _Value = ...,
    cpuset_cpus: _Value = ...,
    cpuset_mems: _Value = ...,
    detach: _Flag = ...,
    detach_keys: _Value = ...,
    device: _Value = ...,
    device_cgroup_rule: _Value = ...,
    device_read_bps: _Value = ...,
    device_read_iops: _Value = ...,
    device_write_bps: _Value = ...,
    device_write_iops: _Value = ...,
    dns: _Value = ...,
    dns_option: _Value = ...,
    dns_search: _Value = ...,
    domainname: _Value = ...,
    entrypoint: _Value = ...,
    env: _Value = ...,
    env_file: _Value = ...,
    expose: _Value = ...,
    gpus: _Value = ...,
    group_add: _Value = ...,
    health_cmd: _Value = ...,
    health_interval: _Value = ...,
    health_retries: _Value = ...,
    health_start_interval: _Value = ...,
    health_start_period: _Value = ...,
    health_timeout: _Value = ...,
    hostname: _Value = ...,
    init: _Flag = ...,
    interactive: _Flag = ...,
    ip: _Value = ...,
    ip6: _Value = ...,
    ipc: _Value = ...,
    isolation: _Value = ...,
    label: _Value = ...,
    label_file: _Value = ...,
    link: _Value = ...,
    link_local_ip: _Value = ...,
    log_driver: _Value = ...,
    log_opt: _Value = ...,
    mac_address: _Value = ...,
    memory: _Value = ...,
    memory_reservation: _Value = ...,
    memory_swap: _Value = ...,
    memory_swappiness: _Value = ...,
    mount: _Value = ...,
    name: _Value = ...,
    network: _Value = ...,
    network_alias: _Value = ...,
    no_healthcheck: _Flag = ...,
    oom_kill_disable: _Flag = ...,
    oom_score_adj: _Value = ...,
    pid: _Value = ...,
    pids_limit: _Value = ...,
    platform: _Value = ...,
    privileged: _Flag = ...,
    publish: _Value = ...,
    publish_all: _Flag = ...,
    pull: _Value = ...,
    quiet: _Flag = ...,
    read_only: _Flag = ...,
    restart: _Value = ...,
    rm: _Flag = ...,
    runtime: _Value = ...,
    security_opt: _Value = ...,
    shm_size: _Value = ...,
    sig_proxy: _Flag = ...,
    stop_signal: _Value = ...,
    stop_timeout: _Value = ...,
    storage_opt: _Value = ...,
    sysctl: _Value = ...,
    tmpfs: _Value = ...,
    tty: _Flag = ...,
    ulimit: _Value = ...,
    use_api_socket: _Flag = ...,
    user: _Value = ...,
    userns: _Value = ...,
    uts: _Value = ...,
    volume: _Value = ...,
    volume_driver: _Value = ...,
    volumes_from: _Value = ...,
    workdir: _Value = ...,
    **flags: Any,
) -> Result

Create and run a new container from an image

Parameters:

Name Type Description Default
add_host _Value

Add a custom host-to-IP mapping (host:ip).

...
annotation _Value

Add an annotation to the container (passed through to the OCI runtime). Defaults to map[].

...
attach _Value

Attach to STDIN, STDOUT or STDERR.

...
blkio_weight _Value

Block IO (relative weight), between 10 and 1000, or 0 to disable. Defaults to 0.

...
blkio_weight_device _Value

Block IO weight (relative device weight). Defaults to [].

...
cap_add _Value

Add Linux capabilities.

...
cap_drop _Value

Drop Linux capabilities.

...
cgroup_parent _Value

Optional parent cgroup for the container.

...
cgroupns _Value

Cgroup namespace to use (host|private) 'host': Run the container in the Docker host's cgroup namespace 'private': Run the container in its own private cgroup namespace '': Use the cgroup namespace as configured by the default-cgroupns-mode option on the daemon (default).

...
cidfile _Value

Write the container ID to the file.

...
cpu_period _Value

Limit CPU CFS (Completely Fair Scheduler) period.

...
cpu_quota _Value

Limit CPU CFS (Completely Fair Scheduler) quota.

...
cpu_rt_period _Value

Limit CPU real-time period in microseconds.

...
cpu_rt_runtime _Value

Limit CPU real-time runtime in microseconds.

...
cpu_shares _Value

CPU shares (relative weight).

...
cpus _Value

Number of CPUs.

...
cpuset_cpus _Value

CPUs in which to allow execution (0-3, 0,1).

...
cpuset_mems _Value

MEMs in which to allow execution (0-3, 0,1).

...
detach _Flag

Run container in background and print container ID.

...
detach_keys _Value

Override the key sequence for detaching a container.

...
device _Value

Add a host device to the container.

...
device_cgroup_rule _Value

Add a rule to the cgroup allowed devices list.

...
device_read_bps _Value

Limit read rate (bytes per second) from a device. Defaults to [].

...
device_read_iops _Value

Limit read rate (IO per second) from a device. Defaults to [].

...
device_write_bps _Value

Limit write rate (bytes per second) to a device. Defaults to [].

...
device_write_iops _Value

Limit write rate (IO per second) to a device. Defaults to [].

...
dns _Value

Set custom DNS servers.

...
dns_option _Value

Set DNS options.

...
dns_search _Value

Set custom DNS search domains.

...
domainname _Value

Container NIS domain name.

...
entrypoint _Value

Overwrite the default ENTRYPOINT of the image.

...
env _Value

Set environment variables.

...
env_file _Value

Read in a file of environment variables.

...
expose _Value

Expose a port or a range of ports.

...
gpus _Value

GPU devices to add to the container ('all' to pass all GPUs).

...
group_add _Value

Add additional groups to join.

...
health_cmd _Value

Command to run to check health.

...
health_interval _Value

Time between running the check (ms|s|m|h). Defaults to 0s.

...
health_retries _Value

Consecutive failures needed to report unhealthy.

...
health_start_interval _Value

Time between running the check during the start period (ms|s|m|h). Defaults to 0s.

...
health_start_period _Value

Start period for the container to initialize before starting health-retries countdown (ms|s|m|h). Defaults to 0s.

...
health_timeout _Value

Maximum time to allow one check to run (ms|s|m|h). Defaults to 0s.

...
hostname _Value

Container host name.

...
init _Flag

Run an init inside the container that forwards signals and reaps processes.

...
interactive _Flag

Keep STDIN open even if not attached.

...
ip _Value

IPv4 address (e.g., 172.30.100.104).

...
ip6 _Value

IPv6 address (e.g., 2001:db8::33).

...
ipc _Value

IPC mode to use.

...
isolation _Value

Container isolation technology.

...
label _Value

Set meta data on a container.

...
label_file _Value

Read in a line delimited file of labels.

...
link _Value

Add link to another container.

...
link_local_ip _Value

Container IPv4/IPv6 link-local addresses.

...
log_driver _Value

Logging driver for the container.

...
log_opt _Value

Log driver options.

...
mac_address _Value

Container MAC address (e.g., 92:d0:c6:0a:29:33).

...
memory _Value

Memory limit.

...
memory_reservation _Value

Memory soft limit.

...
memory_swap _Value

Swap limit equal to memory plus swap: '-1' to enable unlimited swap.

...
memory_swappiness _Value

Tune container memory swappiness (0 to 100). Defaults to -1.

...
mount _Value

Attach a filesystem mount to the container.

...
name _Value

Assign a name to the container.

...
network _Value

Connect a container to a network.

...
network_alias _Value

Add network-scoped alias for the container.

...
no_healthcheck _Flag

Disable any container-specified HEALTHCHECK.

...
oom_kill_disable _Flag

Disable OOM Killer.

...
oom_score_adj _Value

Tune host's OOM preferences (-1000 to 1000).

...
pid _Value

PID namespace to use.

...
pids_limit _Value

Tune container pids limit (set -1 for unlimited).

...
platform _Value

Set platform if server is multi-platform capable.

...
privileged _Flag

Give extended privileges to this container.

...
publish _Value

Publish a container's port(s) to the host.

...
publish_all _Flag

Publish all exposed ports to random ports.

...
pull _Value

Pull image before running ("always", "missing", "never"). Defaults to missing.

...
quiet _Flag

Suppress the pull output.

...
read_only _Flag

Mount the container's root filesystem as read only.

...
restart _Value

Restart policy to apply when a container exits. Defaults to no.

...
rm _Flag

Automatically remove the container and its associated anonymous volumes when it exits.

...
runtime _Value

Runtime to use for this container.

...
security_opt _Value

Security Options.

...
shm_size _Value

Size of /dev/shm.

...
sig_proxy _Flag

Proxy received signals to the process. Defaults to True.

...
stop_signal _Value

Signal to stop the container.

...
stop_timeout _Value

Timeout (in seconds) to stop a container.

...
storage_opt _Value

Storage driver options for the container.

...
sysctl _Value

Sysctl options. Defaults to map[].

...
tmpfs _Value

Mount a tmpfs directory.

...
tty _Flag

Allocate a pseudo-TTY.

...
ulimit _Value

Ulimit options. Defaults to [].

...
use_api_socket _Flag

Bind mount Docker API socket and required auth.

...
user _Value

Username or UID (format: [:]).

...
userns _Value

User namespace to use.

...
uts _Value

UTS namespace to use.

...
volume _Value

Bind mount a volume.

...
volume_driver _Value

Optional volume driver for the container.

...
volumes_from _Value

Mount volumes from the specified container(s).

...
workdir _Value

Working directory inside the container.

...