Error: Cannot connect to the Docker daemon. Is the docker daemon running on this host?

If you are trying to start docker first time, you might get an error "Cannot connect to the Docker daemon. Is the docker daemon running on this host?"


This might happen because of multiple reasons.

1. You might not have permissions to to access docker
You should grant permission to use docker for specific user if he is not  root user.
In order to grant permission execute below command:

$ sudo usermod -aG docker <username>

replace <username> with actual user name. Also make sure you log off/restart machine before using docker, after executing above command.

2. Docker service might not be running

In order to re-start the docker service execute below commands

$ sudo service docker stop
$ sudo service docker start

Now you should be able to use docker.


Golang: Http POST Request with JSON Body example

Go standard library comes with "net/http" package which has excellent support for HTTP Client and Server.   In order to post JSON ...