Estimated reading time: 5 minutes
Many Linux distributions use systemd to start the Docker daemon. This documentshows a few examples of how to customize Docker’s settings.
Docker is a containerization platform that allows you to quickly build, test and deploy applications as portable, self-sufficient containers that can run virtually anywhere. In this tutorial we'll explain how to install Docker on Debian 10 Buster. This tutorial covers how to install Docker on an Ubuntu 20.04 machine. Docker is an open-source containerization platform that allows you to quickly build, test, and deploy applications as portable containers that can run virtually anywhere. Check the correct page under Install Docker. To configure Docker to start automatically at system boot, see Configure Docker to start on boot. Start the daemon manually. If you don’t want to use a system utility to manage the Docker daemon, or just want to test things out, you can manually run it using the dockerd command. Docker is an application that simplifies the process of managing application processes in containers. In this tutorial, you'll install and use Docker Community Edition (CE) on Ubuntu 18.04. For those using it, follow our guide below to install. How To Install Latest Docker Compose on Linux. More articles: Install Docker UI manager – Portainer. Ctop – Top command for container metrics. How to Setup Docker Private Registry on Ubuntu 18.04 / Ubuntu 16.04 with Letsencrypt. Install and Configure Docker Registry on CentOS 7.
Docker Install Systemd
Start the Docker daemon
Start manually
Once Docker is installed, you need to start the Docker daemon.Most Linux distributions use systemctl
to start services.
Start automatically at system boot
If you want Docker to start at boot, seeConfigure Docker to start on boot.
Custom Docker daemon options
There are a number of ways to configure the daemon flags and environment variablesfor your Docker daemon. The recommended way is to use the platform-independentdaemon.json
file, which is located in /etc/docker/
on Linux by default. SeeDaemon configuration file.
Docker Debian Install Systemd
You can configure nearly all daemon configuration options using daemon.json
. The followingexample configures two options. One thing you cannot configure using daemon.json
mechanism isa HTTP proxy.
Runtime directory and storage driver
You may want to control the disk space used for Docker images, containers,and volumes by moving it to a separate partition.
To accomplish this, set the following flags in the daemon.json
file:
HTTP/HTTPS proxy
The Docker daemon uses the HTTP_PROXY
, HTTPS_PROXY
, and NO_PROXY
environmental variables inits start-up environment to configure HTTP or HTTPS proxy behavior. You cannot configurethese environment variables using the daemon.json
file.
This example overrides the default docker.service
file.
If you are behind an HTTP or HTTPS proxy server, for example in corporate settings,you need to add this configuration in the Docker systemd service file.
Note for rootless mode
The location of systemd configuration files are different when running Dockerin rootless mode. When running in rootlessmode, Docker is started as a user-mode systemd service, and uses files storedin each users’ home directory in ~/.config/systemd/user/docker.service.d/
.In addition, systemctl
must be executed without sudo
and with the --user
flag. Select the “rootless mode” tab below if you are running Docker in rootless mode.
Create a systemd drop-in directory for the docker service:
Create a file named
/etc/systemd/system/docker.service.d/http-proxy.conf
that adds theHTTP_PROXY
environment variable:If you are behind an HTTPS proxy server, set the
HTTPS_PROXY
environmentvariable:Multiple environment variables can be set; to set both a non-HTTPS anda HTTPs proxy;
If you have internal Docker registries that you need to contact withoutproxying you can specify them via the
NO_PROXY
environment variable.The
NO_PROXY
variable specifies a string that contains comma-separatedvalues for hosts that should be excluded from proxying. These are theoptions you can specify to exclude hosts:- IP address prefix (
1.2.3.4
) - Domain name, or a special DNS label (
*
) - A domain name matches that name and all subdomains. A domain name witha leading “.” matches subdomains only. For example, given the domains
foo.example.com
andexample.com
:example.com
matchesexample.com
andfoo.example.com
, and.example.com
matches onlyfoo.example.com
- A single asterisk (
*
) indicates that no proxying should be done - Literal port numbers are accepted by IP address prefixes (
1.2.3.4:80
)and domain names (foo.example.com:80
)
Config example:
- IP address prefix (
Flush changes and restart Docker
Verify that the configuration has been loaded and matches the changes youmade, for example:
Docker Ubuntu Install Systemd
Create a systemd drop-in directory for the docker service:
Create a file named
~/.config/systemd/user/docker.service.d/http-proxy.conf
that adds theHTTP_PROXY
environment variable:If you are behind an HTTPS proxy server, set the
HTTPS_PROXY
environmentvariable:Multiple environment variables can be set; to set both a non-HTTPS anda HTTPs proxy;
If you have internal Docker registries that you need to contact withoutproxying, you can specify them via the
NO_PROXY
environment variable.The
NO_PROXY
variable specifies a string that contains comma-separatedvalues for hosts that should be excluded from proxying. These are theoptions you can specify to exclude hosts:- IP address prefix (
1.2.3.4
) - Domain name, or a special DNS label (
*
) - A domain name matches that name and all subdomains. A domain name witha leading “.” matches subdomains only. For example, given the domains
foo.example.com
andexample.com
:example.com
matchesexample.com
andfoo.example.com
, and.example.com
matches onlyfoo.example.com
- A single asterisk (
*
) indicates that no proxying should be done - Literal port numbers are accepted by IP address prefixes (
1.2.3.4:80
)and domain names (foo.example.com:80
)
Config example:
- IP address prefix (
Flush changes and restart Docker
Verify that the configuration has been loaded and matches the changes youmade, for example:
Configure where the Docker daemon listens for connections
SeeConfigure where the Docker daemon listens for connections.
Manually create the systemd unit files
When installing the binary without a package, you may wantto integrate Docker with systemd. For this, install the two unit files(service
and socket
) from the github repositoryto /etc/systemd/system
.