Instantly share code, notes, and snippets.

What would you like to do?
Turn on Docker Remote API on Ubuntu (on port 2375)
# File: etc/default/docker
# Use DOCKER_OPTS to modify the daemon startup options.
DOCKER_OPTS="--dns --dns -H tcp:// -H unix:///var/run/docker.sock"
# File: /lib/systemd/system/docker.service
## Add EnviromentFile + add "$DOCKER_OPTS" at end of ExecStart
## After change exec "systemctl daemon-reload"
ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTS

This comment has been minimized.


jupeter commented Mar 24, 2017

Manual base on moby/moby#25357


This comment has been minimized.

davidkhala commented Sep 26, 2017

after I exec "systemctl daemon-reload", I still have the 2375 port closed.

$ nmap -p 2375 localhost

Starting Nmap 7.01 ( ) at 2017-09-20 16:58 HKT
Nmap scan report for localhost (
Host is up (0.00048s latency).
2375/tcp closed docker

But later after I restart the machine, I found it opened again.


This comment has been minimized.

svengerlach commented Apr 30, 2018

Just landed here while researching the exact same topic.

It's not enough to execute systemctl daemon-reload (according to its manpage), as it only reloads systemctl's configuration but running services remain untouched. However, I recognized that executing systemctl restart docker seems to be sufficient to make dockerd listen on the TCP port.

An another note: At least for 16.04, the service description (docker.service) already takes the DOCKER_OPTS defined in /etc/default/docker into account. It's therefore not necessary to change /lib/systemd/system/docker.service


This comment has been minimized.

dyllanwli commented Dec 5, 2018

Cannot work well using the method above; but I find another Blog and it fixed my problem:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment