skip to Main Content

I few days ago I installed docker in my WSL version 2 on windows. On Ubuntu
I used the following script provided by this page:

https://nickjanetakis.com/blog/install-docker-in-wsl-2-without-docker-desktop

curl -fsSL https://get.docker.com -o get-docker.sh

The problem is that after installing it, docker seems to be ok, but the docker daemon is not working

enter image description here

As you can see I start the service but if then I check the status it says is not running and also when trying to execute a docker compose or something like that also show the error that the docker daemon is not running

What should I check? I have used docker desktop always but I can not use it now so I have to just use docker in WSL

Thanks in advance

2

Answers


  1. You have to issue:

    sudo systemctl start docker.service
    
    Login or Signup to reply.
  2. Follow these steps to use docker in your WSL2 Distro

    1. Check if you have enabled systemd in your WSL2. Open your /etc/wsl.conf and add following line:
    [boot]
    systemd=true
    

    Restart your WSL2 Distro

    wsl --shutdown YOUR_DISTRO
    wsl -d YOUR_DISTRO
    
    1. Install docker

    2. enable the docker daemon with systemd

    sudo systemd start docker
    
    1. check the output of journalctl
    journalctl -u docker.service 
    
    1. Test your installation with
    sudo docker run hello-world
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search