If you want to enable the docker daemons tcp socket for remote access, there are 2 ways to configure it:

1) Configuring at /etc/default/docker file:

DOCKER_OPTS="-H tcp://127.0.0.1:5000 -H unix:///var/run/docker.sock"

2) Configuring at /etc/docker/daemon.json and add:

{
  "hosts": ["tcp://127.0.0.1:2375", "unix:///var/run/docker.sock"]
}

Source: StackOverflow

nano /lib/systemd/system/docker.service

and change

ExecStart=/usr/bin/dockerd -H fd://

to

ExecStart=/usr/bin/dockerd

and restart docker with:

systemctl daemon-reload
service docker restart

tested on:

  • Distributor ID: Ubuntu
    Description: Ubuntu 17.10
    Release: 17.10
    Codename: artful
  • Distributor ID: Ubuntu
    Description: Ubuntu 16.04.4 LTS
    Release: 16.04
    Codename: xenial

Author: Anton Bracke

Software engineering student from Germany. Loves programming in PHP, JS and sometimes C.