Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker: unrecognized service

I am getting this error while running

>service docker start                                                       
docker: unrecognized service
>service docker.io start                                                    
docker.io: unrecognized service

I am struggling with docker in order to run it. I got Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? error. thereafter I tried several things but it did not work.

>docker pull pstothard/cgview                                               
Using default tag: latest                                                                                      
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

 >sudo docker run hello-world                                                
 docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.

>systemctl start docker.service                                             
System has not been booted with systemd as init system (PID 1). Can't operate.

>docker images                                                             
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/images/json: dial unix /var/run/docker.sock: connect: permission denied 

>snap stop docker                                                           
Interacting with snapd is not yet supported on Windows Subsystem for Linux.                                      
This command has been left available for documentation purposes only.

I'm using ubuntu 18.04 app in windows system. what should I do?

like image 473
vibhu sharma Avatar asked Jul 21 '20 10:07

vibhu sharma


People also ask

Is the Docker daemon running?

The operating-system independent way to check whether Docker is running is to ask Docker, using the docker info command. You can also use operating system utilities, such as sudo systemctl is-active docker or sudo status docker or sudo service docker status , or checking the service status using Windows utilities.


1 Answers

Seems like WSL cannot connect to the docker daemon running through Docker for Windows, probably because it is not exposed or is not running.

WSL1

In case you are using WSL 1, you can expose the docker daemon through this option in Docker for Windows: enter image description here I recommend this article for a detailed guide.

I would highly recommend running docker within WSL 2 instead, since it provides faster boot times and allows docker to use CPU/RAM dynamically instead of you having to preallocate it.

WSL2

In case you are using WSL 2, you will have to enable the WSL 2 back-end for docker through Docker for Windows. The docker team has an extensive guide on this here.

like image 171
octagon_octopus Avatar answered Sep 18 '22 18:09

octagon_octopus