Docker – Setup

I am drafting the step-by-steps to install Docker in this post.

VM Setup

I created a new Ubuntu VM 16.04 in my Xen Server with manual network setup. Hence I have given a static IP to this new VM.

I Installed the xentools using the following commands. This is not required if you do not want to install it.

sudo mount /dev/dvd /media
sudo /media/pandian/XenServer\ Tools/Linux/


After successful installation of xentools, a reboot of VM is required.

Install SSH demon.

sudo apt update

sudo apt upgrade

sudo apt-get install openssh-server

sudo apt-get install curl


Add the GPG of docker repository.

curl -fsSL | sudo apt-key add -


Add Docker repository to ubuntu sources and install Docker from docker repo, instead of default ubuntu repo.

sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

sudo apt-get update

apt-cache policy docker-ce

sudo apt-get install -y docker-ce

sudo systemctl status docker

Docker is now installed and started.

But it needs sudo to run docker command.

$ docker info
Got permission denied while trying to connect to the Docker daemon socket at uniial unix /var/run/docker.sock: connect: permission denied
$ sudo docker info

Hence, add the unix user to docker group to avoid it. Here is how we shall do it. Credit goes to digitalocean.

~$ sudo usermod -aG docker ${USER}
~$ su - ${USER}
~$ id -nG
pandian adm cdrom sudo dip plugdev lpadmin sambashare docker

$ id
uid=1000(pandian) gid=1000(pandian) groups=1000(pandian),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare),999(docker)

So the user has been added to docker group. id confirms the same. Now it is the time to run our first hello-world container. As we do not have this image locally, it is downloaded from docker repository.

~$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9db2ca6ccae0: Pull complete
Digest: sha256:4b8ff392a12ed9ea17784bd3c9a8b1fa3299cac44aca35a85c90c5e3c7afacdc
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:

For more examples and ideas, visit:




Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s