Implements the Docker.Command behaviour for docker run.
Builds a docker run command with full support for ports, volumes,
environment variables, labels, capabilities, and resource constraints.
Examples
import Docker.Commands.Run
"nginx:alpine"
|> new()
|> name("my-nginx")
|> port(8080, 80)
|> detach()
|> Docker.run()
Summary
Functions
Adds a Linux capability.
Drops a Linux capability.
Sets the command to run inside the container.
Sets the CPU limit.
Runs in detached mode.
Adds a device.
Adds a DNS server.
Sets the entrypoint.
Adds an environment variable.
Adds an env file.
Adds an extra host mapping.
Sets the health check command.
Sets the health check interval.
Sets the health check retries.
Sets the health check timeout.
Sets the hostname.
Runs an init process inside the container.
Enables interactive mode.
Sets the IPC namespace.
Adds a label.
Sets the logging driver.
Adds a log option.
Sets the memory limit.
Adds a mount specification.
Sets the container name.
Sets the network.
Creates a new run command for the given image.
Sets the PID namespace.
Sets the platform.
Adds a port mapping.
Runs in privileged mode.
Adds raw extra arguments to the command.
Adds a raw flag and value to the command.
Mounts the root filesystem as read-only.
Sets the restart policy.
Removes the container on exit.
Sets the runtime.
Sets the shared memory size.
Adds a tmpfs mount.
Allocates a pseudo-TTY.
Sets the user.
Adds a volume mount.
Sets the working directory inside the container.
Types
@type port_mapping() :: {non_neg_integer(), non_neg_integer(), String.t()}
@type t() :: %Docker.Commands.Run{ cap_add: [String.t()], cap_drop: [String.t()], command: [String.t()] | nil, cpus: String.t() | nil, detach: boolean(), devices: [String.t()], dns: [String.t()], entrypoint: String.t() | nil, env: [env_pair()], env_file: [String.t()], extra_args: [String.t()], extra_hosts: [{String.t(), String.t()}], health_cmd: String.t() | nil, health_interval: String.t() | nil, health_retries: non_neg_integer() | nil, health_timeout: String.t() | nil, hostname: String.t() | nil, image: String.t(), init: boolean(), interactive: boolean(), ipc: String.t() | nil, labels: [env_pair()], log_driver: String.t() | nil, log_opts: [env_pair()], memory: String.t() | nil, mounts: [mount_spec()], name: String.t() | nil, network: String.t() | nil, pid: String.t() | nil, platform: String.t() | nil, ports: [port_mapping()], privileged: boolean(), read_only: boolean(), restart: String.t() | nil, rm: boolean(), runtime: String.t() | nil, shm_size: String.t() | nil, tmpfs: [String.t()], tty: boolean(), user: String.t() | nil, volumes: [volume_mapping()], workdir: String.t() | nil }
Functions
Adds a Linux capability.
Drops a Linux capability.
Sets the command to run inside the container.
Sets the CPU limit.
Runs in detached mode.
Adds a device.
Adds a DNS server.
Sets the entrypoint.
Adds an environment variable.
Adds an env file.
Adds an extra host mapping.
Sets the health check command.
Sets the health check interval.
Sets the health check retries.
Sets the health check timeout.
Sets the hostname.
Runs an init process inside the container.
Enables interactive mode.
Sets the IPC namespace.
Adds a label.
Sets the logging driver.
Adds a log option.
Sets the memory limit.
Adds a mount specification.
Sets the container name.
Sets the network.
Creates a new run command for the given image.
Sets the PID namespace.
Sets the platform.
@spec port(t(), non_neg_integer(), non_neg_integer(), keyword()) :: t()
Adds a port mapping.
Runs in privileged mode.
Adds raw extra arguments to the command.
Adds a raw flag and value to the command.
Mounts the root filesystem as read-only.
Sets the restart policy.
Removes the container on exit.
Sets the runtime.
Sets the shared memory size.
Adds a tmpfs mount.
Allocates a pseudo-TTY.
Sets the user.
Adds a volume mount.
Sets the working directory inside the container.