DOCKER_OPTS do not work in config file /etc/default/docker
See here for later versions of Debian/Ubuntu that use systemd.
This link explains how to correctly modify a systemd unit file to work with DOCKER_OPTS: https://github.com/docker/docker/issues/9889
Essentially you create a /etc/systemd/system/docker.service.d/docker.conf file and specify your overrides there.
I had to do something like the following in the aforementioned file to launch docker with the DOCKER_OPTS environment variable in a systemd environment:
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
[Service]
EnvironmentFile=-/etc/default/docker
ExecStart=
ExecStart=/usr/bin/docker -d $DOCKER_OPTS -H fd://
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
[Install]
WantedBy=multi-user.target
Current docker install process seems to neglect the systemd unit file.
According to docker documentation, The recommended way to configure the daemon flags and environment variables for your Docker daemon is to use a systemd drop-in file.
So, for this specific case, do the following:
Use the command
sudo systemctl edit docker.service
to open an override file fordocker.service
in a text editor.Add or modify the following lines, substituting your own values.
[Service] ExecStart= ExecStart=/usr/bin/dockerd -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock
Save the file.
Reload the
systemctl
configuration.$ sudo systemctl daemon-reload
Restart Docker:
$ sudo systemctl restart docker.service
Check to see whether the change was honored by reviewing the output of
netstat
to confirmdockerd
is listening on the configured port.$ sudo netstat -lntp | grep dockerd tcp 0 0 127.0.0.1:2375 0.0.0.0:* LISTEN 3758/dockerd