Can't run docker in ubuntu 14.04 Cannot connect to the Docker daemon at unix:///var/run/docker.sock

I installed docker using this command:
wget -qO- https://get.docker.com/ | sh

If I run docker info or docker build . I receive this error:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I already tried:

  • sudo usermod -aG docker $USER
  • Restart the entire OS
  • run docker commands with sudo

Some relevant information:

  • sudo service docker status returns:

docker start/running, process 30984

  • docker --version returns:

Docker version 17.04.0-ce, build 4845c56

  • ls /var/run/docker.sock -ls returns:

0 srw-rw---- 1 root docker 0 Apr 21 23:51 /var/run/docker.sock

EDIT 1:
Here’s the /var/log/upstart/docker.log

   mount: wrong fs type, bad option, bad superblock on cgroup,
   missing codepage or helper program, or other error
   (for several filesystems (e.g. nfs, cifs) you might
   need a /sbin/mount.<type> helper program)
   In some cases useful info is found in syslog - try
   dmesg | tail  or so

    /var/run/docker.sock is up

    time="2017-04-22T04:12:02.836658053+03:00" level=info msg="libcontainerd: 
    new containerd process, pid: 16015"
    time="2017-04-22T04:12:03.842433492+03:00" level=error msg="'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded." 
    time="2017-04-22T04:12:03.844424372+03:00" level=error msg="'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded." 
    time="2017-04-22T04:12:03.848579949+03:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
    time="2017-04-22T04:12:03.849767333+03:00" level=warning msg="Your kernel does not support oom control"
    time="2017-04-22T04:12:03.849804648+03:00" level=warning msg="Your kernel does not support memory swappiness"
    time="2017-04-22T04:12:03.849833084+03:00" level=warning msg="Your kernel does not support kernel memory limit"
    time="2017-04-22T04:12:03.849856157+03:00" level=warning msg="Unable to find cpu cgroup in mounts"
    time="2017-04-22T04:12:03.849916780+03:00" level=warning msg="Unable to find cpuset cgroup in mounts"
    time="2017-04-22T04:12:03.849991956+03:00" level=warning msg="mountpoint for pids not found"
    Error starting daemon: Devices cgroup isn't mounted

EDIT 2:
The moby/contrib/check-config.sh at master · moby/moby · GitHub script says that CONFIG_IP_NF_NAT is missing, how can I enable that?

info: reading kernel config from /boot/config...

Generally Necessary:
...
- CONFIG_IP_NF_NAT: missing
...

Edit 3:
running dockerd manually gives the following output:

INFO[0000] libcontainerd: new containerd process, pid: 4368
WARN[0000] containerd: low RLIMIT_NOFILE changing to max  current=1024 max=4096
ERRO[0001] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.
ERRO[0001] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.
INFO[0001] Graph migration to content-addressability took 0.00 seconds
WARN[0001] Your kernel does not support oom control
WARN[0001] Your kernel does not support memory swappiness
WARN[0001] Your kernel does not support kernel memory limit
WARN[0001] Unable to find cpu cgroup in mounts
WARN[0001] Unable to find cpuset cgroup in mounts
WARN[0001] mountpoint for pids not found
Error starting daemon: Devices cgroup isn't mounted

I assume that sudo docker info returns the same error.

Also, what’s the full output of docker --version

Sudo and non-sudo return the same message like any other docker command:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

docker --version returns:

Docker version 17.04.0-ce, build 4845c56

(that is the full output)

To close this thread. It looks like my hosting provider uses a custom kernel so I get this error when dockerd starts:

 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.

There is a bug though: sudo service status docker reports that docker is running when it is not.

Not sure if this will help you, but I was having the same issues with Ubuntu 16.04.

I ultimately purged and reinstalled everything from the docker-ce install. I mean everything. Still not working…

Through my internet wizardry I was able to find an article (I can’t recall where, there were so many) mentioning that the file located at:

$ sudo nano /etc/systemd/system/docker.service

Had a -d in the place of the daemon at Execstart. That wasn’t the case for me. I had …daemon -D…, but I did notice that it was pointing to /usr/bin/local/docker. That didn’t exist, but what does exist is /usr/bin/docker. In that location you will also find docker-containerd, dockerd, etc…

Anyway, I made the change to the docker.service file–simply dropping /local out of there. Saved. Then:

$ systemctl daemon-reload
$ sudo service docker restart
$ sudo service docker status (should see active (running))
$ sudo docker run hello-world

Success!