Installing Docker on Ubuntu machine (cannot connect to the docker deamon..!!?)


Recently I am working on Docker and it’s container setup on my Ubuntu machine. Here are the steps in summary i did to install docker on Ubuntu

  • sudo apt-get install docker.io
    sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
    sudo sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io
    sudo apt-get install apt-transport-https
    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
    sudo sh -c "echo deb https://get.docker.io/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list"
    sudo apt-get update
    sudo apt-get install lxc-docker
  • sudo apt-get install apparmor
  • sudo docker version
  • sudo docker run -i -t ubuntu /bin/bash

I received an error while running “sudo docker version”

“Cannot connect to the Docker daemon. Is ‘docker -d’ running on this host?”

Solution


systemctl unmask docker.service
systemctl unmask docker.socket
systemctl start docker.service

And finally I run “sudo docker version” again – and it gets success

$ sudo docker version
Client:
Version: 1.9.0
API version: 1.21
Go version: go1.4.3
Git commit: 76d6bc9
Built: Tue Nov 3 19:20:09 UTC 2015
OS/Arch: linux/amd64

Server:
Version: 1.9.0
API version: 1.21
Go version: go1.4.3
Git commit: 76d6bc9
Built: Tue Nov 3 19:20:09 UTC 2015
OS/Arch: linux/amd64

Hope this will help someone in need …. Happy Coding… 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s