DEV Community

loading...

Expose docker api on Ubuntu

Abhishek
Ju5t @n07h3r Pr0gr@mm3r
・1 min read

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.

Discussion (0)