Md.Muntasir Mamun
Md.Muntasir Mamun

Reputation: 93

Unable to find image 'hello-world:latest' locally

I have installed docker in my machine following the official installation steps for ubuntu. At the verification steps it fails.

When I run the command: docker run hello-world it throws following error message:

Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry- 
1.docker.io/v2/: net/http: request canceled while waiting for 
connection (Client.Timeout exceeded while awaiting headers).
See 'docker run --help'.  

Below are the docker details for my machine.

Client: Docker Engine - Community
Version:           19.03.6
API version:       1.40
Go version:        go1.12.16
Git commit:        369ce74a3c
Built:             Thu Feb 13 01:27:49 2020
OS/Arch:           linux/amd64
Experimental:      false
Got permission denied while trying to connect to the Docker daemon socket at 
unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/version: dial unix 
/var/run/docker.sock: connect: permission denied

If I tried for docker info I got the following message:

Client: Debug Mode: false

Server: ERROR: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/info: dial unix /var/run/docker.sock: connect: permission denied errors pretty printing info

Upvotes: 5

Views: 43933

Answers (6)

Michal_S
Michal_S

Reputation: 239

In my case disconnecting from VPN solved the problem.

Upvotes: 0

Edoardo Vignati
Edoardo Vignati

Reputation: 553

You can simply pull and test it in this way:

$ sudo docker pull hello-world
$ sudo docker run hello-world

Upvotes: 10

MohanBabu
MohanBabu

Reputation: 475

I had similar problem, while trying to fix the below error,

root@neno88:/home/mohan# docker run hello-world Unable to find image 'hello-world:latest' locally docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 10.187.215.112:53: read udp 10.187.215.103:58777->10.187.215.112:53: read: connection refused.

So, The error was due to the proxy in my enterprise setup, the daemon requests are refused via proxy

WRONG TRY to fix it, ( which caused error like above.) I have added the registry-1.docker.io ip to the /etc/hosts, but it caused the similar error as in this StackOverflow here.

root@neno88:/home/mohan# docker run hello-world Unable to find image 'hello-world:latest' locally docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers). See 'docker run --help'. root@neno88:/home/mohan#

CORRECT STEPS: How to fix it,

  1. Just add your Proxy details to the /etc/systemd/system/docker.service.d/proxy.conf (folder docker.service.d may not exists , so create the directory before)
  2. After adding the proxy details check using the below commands , whether the daemon successfully see/read your environment variables.

$ sudo systemctl daemon-reload

$ sudo systemctl restart docker

$ systemctl show --property=Environment docker

Refer this doc: https://www.serverlab.ca/tutorials/containers/docker/how-to-set-the-proxy-for-docker-on-ubuntu/

Upvotes: 0

Md.Muntasir Mamun
Md.Muntasir Mamun

Reputation: 93

This problem has solved when I upgrade my ubuntu 19.04 to 19.10 and then reinstall it.

Upvotes: 0

Dexter
Dexter

Reputation: 1409

Post installation steps of docker are probably not executed. Basically, the current logged in used need to be added to docker group.

Just follow the instructions here from docker documentation - https://docs.docker.com/engine/install/linux-postinstall/

FYA- group membership evaluation would happen only after a reboot of ubuntu (in 18.04). So, after following the above link, reboot ubuntu machine. Then try docker images and permission issue reported should get resolved.

Upvotes: 0

Aditya T
Aditya T

Reputation: 1733

First check if docker is running using

sudo service docker status

If its running, then you probably missed out adding your user to docker group. To confirm this, try docker commands with sudo

If you don't want to use sudo every time follow below guide to add you user to docker group

Step 2 — Executing the Docker Command Without Sudo (Optional)

NOTE : You can not run Docker in WSL i.e Ubuntu on Windows, so you need to install docker for windows, following guide provided complete steps of using Docker in WSL.

Setting Up Docker for Windows and WSL to Work Flawlessly

Upvotes: 4

Related Questions