DEV Community

Abhishek
Abhishek

Posted on

Expose docker api on Ubuntu

Change file /etc/default/docker

# Use DOCKER_OPTS to modify the daemon startup options.
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"
Enter fullscreen mode Exit fullscreen mode

Change file /lib/systemd/system/docker.service

EnvironmentFile=/etc/default/docker
ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTS
Enter fullscreen mode Exit fullscreen mode

Run

sudo systemctl daemon-reload
sudo service docker restart
Enter fullscreen mode Exit fullscreen mode

Run following to see open ports

lsof -i -P -n | grep LISTEN
Enter fullscreen mode Exit fullscreen mode

If the port 2375 doesn't show up do a system reboot.

Top comments (0)