'Error "cannot connect to Docker daemon" in the ubuntu docker container
I am a newbie to docker and I am performing the following steps
- Installed docker-desktop on windows
- Pulled the image "ubuntu" (tag is "jammy")
- Created the container from the above image
- Tried to pull the 'hello-world' docker image with the command (docker
pull hello-world)
This gives me the following error
Using default tag: latest
**Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?**
I tried to run the command docker version and it gave me the following output
Client:
Version: 20.10.12
API version: 1.41
Go version: go1.17.3
Git commit: 20.10.12-0ubuntu4
Built: Mon Mar 7 17:10:06 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I then tried the command sudo service docker start but it gives me the below error
docker: unrecognized service
I am stuck here and am trying to find a way to make the docker commands work in my ubuntu docker container. Please help me in understanding what is going wrong and how to resolve it.
Ubuntu version on the container:
PRETTY_NAME="Ubuntu 22.04 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
Note 1: I have used the sudo also for all the above commands but still the same result.
Note 2: I have also enabled Expose daemon on tcp://localhost:2375 without TLS option in the docker desktop and restarted my pc
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
