Cannot execute Docker Commands in UNIX environment - docker

I installed the Docker installation to my UNIX (macOS), once I execute simple commands like,
$ docker run ubuntu
it shows following error prompted in terminal:
docker: Error response from daemon: dial unix docker.raw.sock: connect: no such file or directory.
I tried in several docker commands, but docker daemon throws the mentioned error message.

This is issue of Docker Engine startup not linked with docker demons, I resolved this problem by Reset to Factory Settings option in Docker Troubleshooting pane

Related

Error while checking if volume "nvidia_driver_410.48" exists in driver "nvidia-docker"

I come across this error when running an image on nvidia-docker. This image used to run well, but now it fails. The change in the device I'm made: cloned docker/compose, then removed docker/compose.
I manage to run nvidia-docker hello-world, but this does not use Nvidia drivers.
I replaced XXX instead of the full path.
running command:
nvidia-docker run --name my_test arg1 bash
Blockquote
docker: Error response from daemon: create nvidia_driver_410.48: found reference to volume 'nvidia_driver_410.48' in driver 'nvidia-docker', but got an error while checking the driver: error while checking if volume "nvidia_driver_410.48" exists in driver "nvidia-docker": Post http://XXXdocker%2Fplugins%2Fnvidia-docker.sock/VolumeDriver.Get: dial unix XXX/docker/plugins/nvidia-docker.sock: connect: connection refused: volume name must be unique.
Blockquote
Try to delete the old containers(including stopped containers), list and delete the nvidia docker volumes. Restart docker daemon if this does not solve the problem.
Else: try to purge/reinstall nvidia-container-toolkit and restart the docker daemon on top of the aforementioned step.

Docker Installation Problems

I'm new to using Docker (never used it before) and I'm running into these errors:
I installed the Docker for Windows and following the steps on this
tutorial, but Docker Desktop doesn't load up for me at all.
I tried to run the docker pull hello-world command but I'm getting the error: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
How do I fix this? Thanks

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
You can simply pull and test it in this way:
$ sudo docker pull hello-world
$ sudo docker run hello-world
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
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.
This problem has solved when I upgrade my ubuntu 19.04 to 19.10 and then reinstall it.
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,
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)
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/

Error building Docker image in Windows 7

New to docker and I'm using Windows 7 SP1. It looks like docker is running fine in my machine as I have tried running hello-world by command docker run hello-world as instructed in the tutorial and got expected result. Now all I'm trying to do is create a docker image for a .net core console app. My app built and ran. but while building docker image by command docker build -t myapp . I get the below error
error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.30/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&c
puquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=
duke&target=&ulimits=null: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on
Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
Below my Dockerfile
FROM microsoft/dotnet:1.1-runtime-nanoserver
WORKDIR /DotNetConsole
COPY /bin/Debug/netcoreapp1.1/publish/ .
ENTRYPOINT ["dotnet", "DotNetConsole.dll"]
I could get around this problem by starting the "Docker QuickStart Terminal" installed with the docker tools, and running the commands for building the docker images from there.
If I used GIT BASH instead of the Docker QuickStart Terminal to execute the commands, I would get this kind of error. So it seems that if the commands are not executed from the Docker terminal itself, these errors show up.

Error Pulling private docker repository from mac Boot2Docker

From my mac, successfully install Boot2Docker and everything seems to work well...
However when I try to pull a remote private repository using the following command:
sudo docker pull xxxx/yyyy I get this error message:
FATA[0000] Post http:///var/run/docker.sock/v1.16/images/create?fromImage=xxxx%2Fdev%3Alatest: dial unix /var/run/docker.sock: no such file or directory
When I try using this command docker pull xxxx/yyyy I got this error message:
Pulling repository xxxx/yyyy
FATA[0000] Error: image xxxx/yyyy:latest not found
Can anyone already experiment this error message from mac Boot2Docker ? Yes please let me know how to fix it.
Thanks.
Troubleshooting steps
Try restarting boot2docker
boot2docker restart
ssh into boot2docker boot2docker ssh and then see if the docker process is running ps aux | grep -i '/usr/local/bin/docker -d -D' | grep -v grep
Can you do a docker pull nginx from inside boot2docker? This is to test if docker daemon is functional from inside the boot2docker VM
Check if the docker daemon unix socket file exists inside the boot2docker VM ls /var/run/docker.sock
These steps should help you figure out whats wrong.

Resources