Docker Community Forums

Share and learn in the Docker community.

Setting DOCKER_OPTS Ubuntu w/SystemD


(Ronald Petty) #1


I am unable to find an example of DOCKER_OPTS (ex. -H) being set for Ubuntu 16.04.1 (which uses SystemD.) The documentation here mentions using a Unit file.

I see other examples where people set docker.service. I tried both approaches and have not succeeded (did systemctl daemon-reload and docker reload.)

I am unclear about all the ways to use SystemD. Specifically, I was trying:

sudo vi /etc/systemd/system/docker.service.d/docker-opts.conf

Environment=‘DOCKER_OPTS=-H tcp://’

user@ubuntu:~$ sudo systemctl daemon-reload
user@ubuntu:~$ systemctl reload docker
user@ubuntu:~$ systemctl show --property=Environment docker
user@ubuntu:~$ ps wuxa | grep docker
root       8292  0.0  1.0 484720 40752 ?        Ssl  10:31   0:08 /usr/bin/dockerd -H fd://
root       8299  0.0  0.2 209564 10416 ?        Ssl  10:31   0:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --runtime docker-runc

Notice no -H set in ‘ps’. Also, in the systemctl show output, there is backslash x ‘\x’ for a space. I have not resolved that.

The link states to not touch docker.service and use unit files. I thought I was doing that, but I must be missing a step / idea.