Docker for newbies

Setup

1. For linux systems, docker can be easily installed using the Package Manager (apt or apt-get for Ubuntu)

sudo apt-get update
sudo apt-get install docker.io

2. Now we need to enable docker to start at the startup of OS

sudo systemctl start docker
sudo systemctl enable docker

3. Now reboot your computer and check if docker is installed properly.

docker --version

The version should look something like this.

docker-version

Debugging

1. Error showing 'permission denied' while trying to connect to docker socket - /var/run/docker.sock
Solution: The error message tells that the current user doesn't have admin access to the docker engine. There are 2 ways to tackle this.

a) write sudo before the command.

b) sudo usermod -a -G docker $USER

The second is a better and permanent solution