I also received the error message below, after installing the docker and running: docker run hello-world #Cannot connect to the Docker daemon at unix: /var/run/docker.sock. Is the docker daemon running?
Here's a solution, what worked for me. Environment
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo apt-get update
sudo add-apt-repository "deb [arch = amd64] https://download.docker.com/linux/ubuntu $ (lsb_release -cs) stable "
sudo apt-get update
sudo apt-get install docker-ce = 5: 18.09.9 ~ 3-0 ~ ubuntu-bionic docker-ce-cli = 5: 18.09.9 ~ 3-0 ~ ubuntu-bionic containerd.io
export DOCKER_HOST="tcp://0.0.0.0:2375"
Note: put the command above in your profile to start with the ubunto ex: echo "export DOCKER_HOST="tcp://0.0.0.0:2375"" >> ~/.bashrc
sudo usermod -aG docker $USER
(Close and open the ubuntu window again) or run:
source ~/.bashrc
docker run hello-world
Hello from Docker! This message shows that your installation appears to be working correctly.
Note: if it fails, run the command again:
export DOCKER_HOST="tcp://0.0.0.0:2375"
Reference: https://docs.docker.com/engine/install/ubuntu/ Session: INSTALL DOCKER ENGINE
#For other versions of the docker that can be installed with ubuntu, see the repository using the command below: apt-cache madison docker-ce
sudo apt-get install docker-ce = <VERSION_STRING> docker-ce-cli = <VERSION_STRING> containerd.io