Skip to content

Instantly share code, notes, and snippets.

@piotrplenik
Created March 24, 2017 09:00
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save piotrplenik/b39e11521452129af2af85cc855c91d7 to your computer and use it in GitHub Desktop.
Save piotrplenik/b39e11521452129af2af85cc855c91d7 to your computer and use it in GitHub Desktop.
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=""
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4 -H tcp://127.0.0.1:2375 -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"
EnvironmentFile=/etc/default/docker
ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTS
@lepe
Copy link

lepe commented Mar 2, 2020

In summary, you need to edit the file: /lib/systemd/system/docker.service
Instead of: tcp://127.0.0.1:2375, use the host IP address, for example: tcp://192.168.1.100:2375.

Then execute:
systemctl daemon-reload
systemctl restart docker

Remember that setting remote access is not recommended, as someone could gain root access to the host.

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