dockerd
daemon
Usage: dockerd [OPTIONS]
A self-sufficient runtime for containers.
Options:
--add-runtime runtime Register an additional OCI compatible runtime (default [])
--allow-nondistributable-artifacts list Allow push of nondistributable artifacts to registry
--api-cors-header string Set CORS headers in the Engine API
--authorization-plugin list Authorization plugins to load
--bip string Specify network bridge IP
-b, --bridge string Attach containers to a network bridge
--cdi-spec-dir list CDI specification directories to use
--cgroup-parent string Set parent cgroup for all containers
--config-file string Daemon configuration file (default "/etc/docker/daemon.json")
--containerd string containerd grpc address
--containerd-namespace string Containerd namespace to use (default "moby")
--containerd-plugins-namespace string Containerd namespace to use for plugins (default "plugins.moby")
--cpu-rt-period int Limit the CPU real-time period in microseconds for the
parent cgroup for all containers (not supported with cgroups v2)
--cpu-rt-runtime int Limit the CPU real-time runtime in microseconds for the
parent cgroup for all containers (not supported with cgroups v2)
--cri-containerd start containerd with cri
--data-root string Root directory of persistent Docker state (default "/var/lib/docker")
-D, --debug Enable debug mode
--default-address-pool pool-options Default address pools for node specific local networks
--default-cgroupns-mode string Default mode for containers cgroup namespace ("host" | "private") (default "private")
--default-gateway ip Container default gateway IPv4 address
--default-gateway-v6 ip Container default gateway IPv6 address
--default-ipc-mode string Default mode for containers ipc ("shareable" | "private") (default "private")
--default-network-opt mapmap Default network options (default map[])
--default-runtime string Default OCI runtime for containers (default "runc")
--default-shm-size bytes Default shm size for containers (default 64MiB)
--default-ulimit ulimit Default ulimits for containers (default [])
--dns list DNS server to use
--dns-opt list DNS options to use
--dns-search list DNS search domains to use
--exec-opt list Runtime execution options
--exec-root string Root directory for execution state files (default "/var/run/docker")
--experimental Enable experimental features
--feature map Enable feature in the daemon
--fixed-cidr string IPv4 subnet for fixed IPs
--fixed-cidr-v6 string IPv6 subnet for fixed IPs
-G, --group string Group for the unix socket (default "docker")
--help Print usage
-H, --host list Daemon socket(s) to connect to
--host-gateway-ip ip IP address that the special 'host-gateway' string in --add-host resolves to.
Defaults to the IP address of the default bridge
--http-proxy string HTTP proxy URL to use for outgoing traffic
--https-proxy string HTTPS proxy URL to use for outgoing traffic
--icc Enable inter-container communication (default true)
--init Run an init in the container to forward signals and reap processes
--init-path string Path to the docker-init binary
--insecure-registry list Enable insecure registry communication
--ip ip Default IP when binding container ports (default 0.0.0.0)
--ip-forward Enable net.ipv4.ip_forward (default true)
--ip-masq Enable IP masquerading (default true)
--ip6tables Enable addition of ip6tables rules (experimental)
--iptables Enable addition of iptables rules (default true)
--ipv6 Enable IPv6 networking
--label list Set key=value labels to the daemon
--live-restore Enable live restore of docker when containers are still running
--log-driver string Default driver for container logs (default "json-file")
--log-format string Set the logging format ("text"|"json") (default "text")
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
--log-opt map Default log driver options for containers (default map[])
--max-concurrent-downloads int Set the max concurrent downloads (default 3)
--max-concurrent-uploads int Set the max concurrent uploads (default 5)
--max-download-attempts int Set the max download attempts for each pull (default 5)
--metrics-addr string Set default address and port to serve the metrics api on
--mtu int Set the containers network MTU (default 1500)
--network-control-plane-mtu int Network Control plane MTU (default 1500)
--no-new-privileges Set no-new-privileges by default for new containers
--no-proxy string Comma-separated list of hosts or IP addresses for which the proxy is skipped
--node-generic-resource list Advertise user-defined resource
--oom-score-adjust int Set the oom_score_adj for the daemon
-p, --pidfile string Path to use for daemon PID file (default "/var/run/docker.pid")
--raw-logs Full timestamps without ANSI coloring
--registry-mirror list Preferred registry mirror
--rootless Enable rootless mode; typically used with RootlessKit
--seccomp-profile string Path to seccomp profile. Use "unconfined" to disable the default seccomp profile (default "builtin")
--selinux-enabled Enable selinux support
--shutdown-timeout int Set the default shutdown timeout (default 15)
-s, --storage-driver string Storage driver to use
--storage-opt list Storage driver options
--swarm-default-advertise-addr string Set default address or interface for swarm advertised address
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default "~/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default "~/.docker/cert.pem")
--tlskey string Path to TLS key file (default "~/.docker/key.pem")
--tlsverify Use TLS and verify the remote
--userland-proxy Use userland proxy for loopback traffic (default true)
--userland-proxy-path string Path to the userland proxy binary
--userns-remap string User/Group setting for user namespaces
--validate Validate daemon configuration and exit
-v, --version Print version information and quit
Options with [] may be specified multiple times.
Description
dockerd
is the persistent process that manages containers. Docker
uses different binaries for the daemon and client. To run the daemon you
type
dockerd
.
To run the daemon with debug output, use
dockerd --debug
or add
"debug": true
the
daemon.json
file
.
Note
Enabling experimental features
Enable experimental features by starting
dockerd
with the--experimental
flag or adding"experimental": true
to thedaemon.json
file.
Environment variables
The following list of environment variables are supported by the
dockerd
daemon.
Some of these environment variables are supported both by the Docker Daemon and
the
docker
CLI. Refer to
Environment variables
to learn about environment variables supported by the
docker
CLI.
Variable | Description |
---|---|
DOCKER_CERT_PATH
|
Location of your authentication keys. This variable is used both by the
docker
CLI
and the
dockerd
daemon.
|
DOCKER_DRIVER
|
The storage driver to use. |
DOCKER_RAMDISK
|
If set this disables
pivot_root
.
|
DOCKER_TLS_VERIFY
|
When set Docker uses TLS and verifies the remote. This variable is used both by the
docker
CLI
and the
dockerd
daemon.
|
DOCKER_TMPDIR
|
Location for temporary files created by the daemon. |
HTTP_PROXY
|
Proxy URL for HTTP requests unless overridden by NoProxy. See the Go specification for details. |
HTTPS_PROXY
|
Proxy URL for HTTPS requests unless overridden by NoProxy. See the Go specification for details. |
MOBY_DISABLE_PIGZ
|
Disables the use of
unpigz
to decompress layers in parallel when pulling images, even if it is installed.
|
NO_PROXY
|
Comma-separated values specifying hosts that should be excluded from proxying. See the Go specification for details. |
Examples
Proxy configuration
Note
Refer to the Docker Desktop manual if you are running Docker Desktop .
If you are behind an HTTP proxy server, for example in corporate settings, you may have to configure the Docker daemon to use the proxy server for operations such as pulling and pushing images. The daemon can be configured in three ways:
-
Using environment variables (
HTTP_PROXY
,HTTPS_PROXY
, andNO_PROXY
). -
Using the
http-proxy
,https-proxy
, andno-proxy
fields in the daemon configuration file (Docker Engine version 23.0 or later). -
Using the
--http-proxy
,--https-proxy
, and--no-proxy
command-line options. (Docker Engine version 23.0 or later).
The command-line and configuration file options take precedence over environment
variables. Refer to
control and configure Docker with systemd
to set these environment variables on a host using
systemd
.
Daemon socket option
The Docker daemon can listen for
Docker Engine API
requests via three different types of Socket:
unix
,
tcp
, and
fd
.
By default, a
unix
domain socket (or IPC socket) is created at
/var/run/docker.sock
, requiring either
root
permission, or
docker
group
membership.
If you need to access the Docker daemon remotely, you need to enable the tcp
Socket. When using a TCP socket, the Docker daemon provides un-encrypted and
un-authenticated direct access to the Docker daemon by default. You should secure
the daemon either using the
built in HTTPS encrypted socket
,
or by putting a secure web proxy in front of it. You can listen on port
2375
on all
network interfaces with
-H tcp://0.0.0.0:2375
, or on a particular network
interface using its IP address:
-H tcp://192.168.59.103:2375
. It is
conventional to use port
2375
for un-encrypted, and port
2376
for encrypted
communication with the daemon.
Note
If you're using an HTTPS encrypted socket, keep in mind that only TLS version 1.0 and higher is supported. Protocols SSLv3 and below are not supported for security reasons.
On systemd based systems, you can communicate with the daemon via
systemd socket activation
,
with
dockerd -H fd://
. Using
fd://
works for most setups, but
you can also specify individual sockets:
dockerd -H fd://3
. If the
specified socket activated files aren't found, the daemon exits. You can
find examples of using systemd socket activation with Docker and systemd in the
Docker source tree
.
You can configure the Docker daemon to listen to multiple sockets at the same
time using multiple
-H
options:
The example below runs the daemon listening on the default Unix socket, and on 2 specific IP addresses on this host:
$ sudo dockerd -H unix:///var/run/docker.sock -H tcp://192.168.59.106 -H tcp://10.10.10.2
The Docker client honors the
DOCKER_HOST
environment variable to set the
-H
flag for the client. Use
one
of the following commands:
$ docker -H tcp://0.0.0.0:2375 ps
$ export DOCKER_HOST="tcp://0.0.0.0:2375"
$ docker ps
Setting the
DOCKER_TLS_VERIFY
environment variable to any value other than
the empty string is equivalent to setting the
--tlsverify
flag. The following
are equivalent:
$ docker --tlsverify ps
$ export DOCKER_TLS_VERIFY=1
$ docker ps
The Docker client honors the
HTTP_PROXY
,
HTTPS_PROXY
, and
NO_PROXY
environment variables (or the lowercase versions thereof).
HTTPS_PROXY
takes
precedence over
HTTP_PROXY
.
The Docker client supports connecting to a remote daemon via SSH:
$ docker -H ssh://[email protected]:22/var/run/docker.sock ps
$ docker -H ssh://[email protected]:22 ps
$ docker -H ssh://[email protected] ps
$ docker -H ssh://example.com ps
To use SSH connection, you need to set up
ssh
so that it can reach the
remote host with public key authentication. Password authentication is not
supported. If your key is protected with passphrase, you need to set up
ssh-agent
.
Bind Docker to another host/port or a Unix socket
Warning
Changing the default
docker
daemon binding to a TCP port or Unixdocker
user group introduces security risks, as it may allow non-root users to gain root access on the host. Make sure you control access todocker
. If you are binding to a TCP port, anyone with access to that port has full Docker access; so it's not advisable on an open network.
With
-H
it's possible to make the Docker daemon to listen on a specific IP
and port. By default, it listens on
unix:///var/run/docker.sock
to allow
only local connections by the root user. You could set it to
0.0.0.0:2375
or
a specific host IP to give access to everybody, but that isn't recommended
because someone could gain root access to the host where the daemon is running.
Similarly, the Docker client can use
-H
to connect to a custom port.
The Docker client defaults to connecting to
unix:///var/run/docker.sock
on Linux, and
tcp://127.0.0.1:2376
on Windows.
-H
accepts host and port assignment in the following format:
tcp://[host]:[port][path] or unix://path
For example:
-
tcp://
-> TCP connection to127.0.0.1
on either port2376
when TLS encryption is on, or port2375
when communication is in plain text. -
tcp://host:2375
-> TCP connection on host:2375 -
tcp://host:2375/path
-> TCP connection on host:2375 and prepend path to all requests -
unix://path/to/socket
-> Unix socket located atpath/to/socket
-H
, when empty, defaults to the same value as
when no
-H
was passed in.
-H
also accepts short form for TCP bindings:
host:
or
host:port
or
:port
Run Docker in daemon mode:
$ sudo <path to>/dockerd -H 0.0.0.0:5555 &
Download an
ubuntu
image:
$ docker -H :5555 pull ubuntu
You can use multiple
-H
, for example, if you want to listen on both
TCP and a Unix socket
$ sudo dockerd -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock &
# Download an ubuntu image, use default Unix socket
$ docker pull ubuntu
# OR use the TCP port
$ docker -H tcp://127.0.0.1:2375 pull ubuntu
Daemon storage-driver
On Linux, the Docker daemon has support for several different image layer storage
drivers:
overlay2
,
fuse-overlayfs
,
btrfs
, and
zfs
.
overlay2
is the preferred storage driver for all currently supported Linux distributions,
and is selected by default. Unless users have a strong reason to prefer another storage driver,
overlay2
should be used.
You can find out more about storage drivers and how to select one in Select a storage driver .
On Windows, the Docker daemon only supports the
windowsfilter
storage driver.
Options per storage driver
Particular storage-driver can be configured with options specified with
--storage-opt
flags. Options for
zfs
start with
zfs
, and options for
btrfs
start with
btrfs
.
ZFS options
zfs.fsname
Specifies the ZFS filesystem that the daemon should use to create its datasets.
By default, the ZFS filesystem in
/var/lib/docker
is used.
Example
$ sudo dockerd -s zfs --storage-opt zfs.fsname=zroot/docker
Btrfs options
btrfs.min_space
Specifies the minimum size to use when creating the subvolume which is used for containers. If user uses disk quota for btrfs when creating or running a container with --storage-opt size option, Docker should ensure the size can't be smaller than btrfs.min_space .
Example
$ sudo dockerd -s btrfs --storage-opt btrfs.min_space=10G
Overlay2 options
overlay2.size
Sets the default max size of the container. It is supported only when the
backing filesystem is
xfs
and mounted with
pquota
mount option. Under these
conditions the user can pass any size less than the backing filesystem size.
Example
$ sudo dockerd -s overlay2 --storage-opt overlay2.size=1G
Windowsfilter options
size
Specifies the size to use when creating the sandbox which is used for containers. Defaults to 20G.
Example
C:\> dockerd --storage-opt size=40G
Runtime options
The Docker daemon relies on a
OCI
compliant runtime
(invoked via the
containerd
daemon) as its interface to the Linux
kernel
namespaces
,
cgroups
, and
SELinux
.
Configure container runtimes
By default, the Docker daemon uses runc as a container runtime. You can configure the daemon to add additional runtimes.
containerd shims installed on
PATH
can be used directly, without the need
to edit the daemon's configuration. For example, if you install the Kata
Containers shim (
containerd-shim-kata-v2
) on
PATH
, then you can select that
runtime with
docker run
without having to edit the daemon's configuration:
$ docker run --runtime io.containerd.kata.v2
Container runtimes that don't implement containerd shims, or containerd shims
installed outside of
PATH
, must be registered with the daemon, either via the
configuration file or using the
--add-runtime
command line flag.
For examples on how to use other container runtimes, see Alternative container runtimes
Configure runtimes using
daemon.json
To register and configure container runtimes using the daemon's configuration
file, add the runtimes as entries under
runtimes
: