Home > OS >  Creating images on Docker
Creating images on Docker

Time:11-11

I'm trying to make docker applications using Ubuntu 18.04 LTS. I have installed Docker Desktop and am trying to use Python for application code. I cannot seem to manage to get this working, I end up getting the same error :

The command 'docker' could not be found in this WSL 1 distro. We recommend to convert this distro to WSL 2 and activate the WSL integration in Docker Desktop settings.

I tried several suggestions on the Internet, without any succes. The main problem resides, I think, in the fact that I am trying to run Docker Desktop on Windows Home. Can anyone help out?

CodePudding user response:

Judging from the error message, you have installed Docker in Windows, not in Ubuntu. Is that correct?
You would need to install Docker directly on your Linux distro (Ubuntu 18.04 LTS, here's how) or use WSL version 2. Only with WSL 2 it's possible to use Docker Desktop on Windows with WSL.

You can find a comparison of WSL 1 and 2 here: https://docs.microsoft.com/en-us/windows/wsl/compare-versions

Convert your Ubuntu installation to WSL 2 using these instructions: https://docs.microsoft.com/en-us/windows/wsl/basic-commands#set-wsl-version-to-1-or-2

CodePudding user response:

In powershell run the command:

wsl --install

This command will enable the required optional components, download the latest Linux kernel, set WSL 2 as your default, and install a Linux distribution for you (Ubuntu by default, see below to change this). https://docs.microsoft.com/en-us/windows/wsl/install

If this didn't work then you can manually set the WSL 2 as your default following the below link:

https://docs.microsoft.com/en-gb/windows/wsl/install-manual#step-5---set-wsl-2-as-your-default-version

And then you can open Docker Desktop and enable WSL 2. Go to Settings -> General

WSL 2 based engine

Select the Use WSL 2 based engine check box. And then click Apply & Restart.

Then go to Settings -> Resources -> WSL INTEGRATION

Select distro

Select the Enable integration with my default distro And select your distro, for example ubuntu and click Apply & Restart.

Finally you should be able to execute docker command in you ubuntu WSL

  • Related