'docker" command cannot be found in this WSL1 distro - docker

While attempting to install, in VS Code, the Fabric samples and binaries through the curl command :
I've encountered the following error, as soon as Fabric docker images are pulled :
The command 'docker' could not be found in this WSL1 distro. We recommend to convert this distro into
WSL 2 and activate the WSL integration in Docker Desktop settings.
N.B: Docker version 20.10.0-beta1
Thus any relevant feedback, not impacting the usage of the IBM Blockchain Platform v.1.0.39 (e.g. prerequisites installed), would highly be appreciated.
Best

See the Docker Desktop WSL 2 backend guide.
Specifically, you need to convert your Ubuntu distribution to WSL2 (it is currently WSL1). To do so, see Step 6 in the Install section:
To upgrade your existing Linux distro to v2, run:
wsl.exe --set-version Ubuntu 2
Either that, or create a new WSL instance by backing up the WSL1 version (wsl --export) and then importing it into a new copy (wsl --import). See wsl --help for the parameters needed.
Then proceed with the rest of the Docker installation instructions.

in my case, resolved by enabling the WSL2 distro option in the docker settings.
As the log says (in your qusetion)
We recommend to convert this distro into WSL 2 and activate the WSL integration in Docker Desktop settings.
in Docker Settings
go Resources
go WSL INTEGRATION
check Enable integration with my default WSL distro
Apply & Restart

I faced the same issue and solved it by navigating to: docker desktop > Resources > wsl integration then choose the right distro for integrating docker with.

Related

Ubuntu Error "The command 'docker' could not be found in this WSL 2 distro."

I'm running WSL 2 on Ubuntu and having some issues getting docker up and running on my computer. I have Docker Desktop installed and running in the background, and I also have WSL integration enabled with Ubuntu.
When I try to run simple docker commands, such as docker --version, I receive this error:
The command 'docker' could not be found in this WSL 2 distro.
We recommend to activate the WSL integration in Docker Desktop
settings.
For details about using Docker Desktop with WSL 2, visit:
https://docs.docker.com/go/wsl2/
I have already visited the link and followed all the instructions it gives, enabling WSL integration with Ubuntu as shown here:
However the error I receive is still the same. Does anyone know how to fix this?
Note: I can run Docker commands (such as docker --version) in PowerShell and Command Prompt, but it is unrecognized in Ubuntu.
"Docker Desktop" should integrate into WSL without additional configuration. Especially, it should not be necessary to append folders to the PATH environment variable.
Of course it must be made sure that "Docker Desktop" as well as the certain WSL distribution are set up for WSL2: In "Docker Desktop" settings "General/Use the WSL2 based engine" must be checked and wsl -l -v should list version 2. If the latter is not true, it can be fixed by wsl --set-version <distribution> 2, where <distribution> is the name from the previous list. Note that "Ubuntu" and "Ubuntu-22.04" (for example) are different.
"Docker Desktop" normally integrates with the default distribution. It can be seen from the asterisk in wsl -l -v which one had been chosen. For me this once was set to "docker-desktop-data" (probably because "Docker Desktop" had been installed earlier than the distribution). The default distribution can be changed by wsl --set-default <distribution>. Furthermore, in "Resources/WSL integration" of "Docker Desktop" settings, the option "Enable integration with my default WSL distro" must be set.
If another distribution than the default one should use docker as well, it needs to be selected explicitely in the list of distributions of "Resources/WSL integration". Press "Refresh" if that other distribution had been installed recently while "Docker Desktop" was already running.
"Integration" means, as far as I can tell, that a link /usr/bin/docker, pointing to /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker, is created automatically. Since /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker seems to be available in all distributions regardless of the integration setting, the presence (or not) of /mnt/wsl/docker-desktop/cli-tools/usr/bin and its content might help to analyse the problem. There should be docker, docker-compose and others:
ls -l /usr/bin/docker
ls -l /mnt/wsl/docker-desktop/cli-tools/usr/bin
I was having this problem, so I went to this docker link (your link is broken) and worked through the suggestions.
This worked for me:
In PowerShell, type wsl -l -v and you should get something like this:
NAME STATE VERSION
* Ubuntu Running 2
docker-desktop Running 2
Ubuntu-20.04 Running 2
docker-desktop-data Running 2
Go into the Docker Desktop Settings -> Resources -> WSL integration.
Select the WSL 2 distro you are using from the above list (e.g. Ubuntu 20.04 in my case) and Apply & Restart.
Now running the version command works as expected in my distribution, and I have all of the functionality required from within the WSL terminal.
:~$ docker -v
Docker version 20.10.16, build aa7e414
Try to put following line in your Ubuntu's ~/.bashrc
PATH+=":/mnt/c/Program Files/Docker/Docker/Resources/bin"
( It might be /c/Program Files/... depending on your mount point. You can check with the command df )
and start a new bash shell, then run docker.
I was able to fix this by taking the below steps but it required some work arounds because I was unable to click-install the necessary WSL2 Linux kernel update after downloading.
Then I had to complete this process.
Then I had go to the PowerShell command line and navigate to the location of the above WSL Update and run the following (in administrator mode-- and not in the Linux command line):
& '.\wsl_update_x64.msi'
That was the only way I could successfully install the update
Then at Powershell command line (in administrator mode-- and not the linux command line), I ran
wsl --set-version Ubuntu 2
per instructions here
Today I had this problem too. In WSL I got a message that I could update WSL from the microsoft store. So I updated WSL and after that moment docker wasn't on my PATH anymore.
It was a lazy saturday morning, so I decided to restart my PC. And magically the problem was "fixed".
Maybe it would be enough to restart WSL distro, at this moment I don't have the time to research whether that would be a good solution.

Docker for windows missing quick start terminal

I installed the latest version of Docker for windows in my windows 10 machine. It seems the new Docker Desktop toolbox doesn't contain the Quick start terminal. Every documentation says to check the quick start terminal option at the time of installation. I dont see any option to check that option with the latest Docker toolbox.
Is there any way we could install Quick start terminal for windows.
Or are there any other alternate to the QS terminal. My objective is to build, tag and push / pull docker images to a gitlab registry. Powershell, command promt doesn't work because its a windows machine.
with the new Docker-for-desktop versions there's no need for the added toolbox as marked here
Legacy desktop solution. Docker Toolbox is for older Mac and Windows
systems that do not meet the requirements of Docker for Mac and
Docker for Windows. We recommend updating to the newer applications,
if possible.
You can just open any typical terminal in your OS of choice and use the docker cli if you can't remember the exact usage try docker --help 😉

Creating images on Docker

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?
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://learn.microsoft.com/en-us/windows/wsl/compare-versions
Convert your Ubuntu installation to WSL 2 using these instructions:
https://learn.microsoft.com/en-us/windows/wsl/basic-commands#set-wsl-version-to-1-or-2
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://learn.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://learn.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

Docker for Windows installed WSL2 without apt

I'm trying to work on a project, and the setup steps begin like this:
Clone the repo
Set up Docker
Run make
Being a Windows user, I installed Docker for Windows, and it installed WSL2 to get all the Linux stuff set up. But when I went to run make from the WSL shell, it couldn't find it. So I tried to get make from apt-get... and that wasn't there either!
It would appear that my WSL2 install is broken. Unfortunately, Googling for it hasn't turned up much of use. So how do I obtain apt for WSL so that I can build my toolchain?
Something similar happened to me: I installed Docker Desktop in Windows some months ago and it configured WSL to run behind it. However, it was WSL version 1 instead of version 2, and it did not install any Linux distro, since both apps run on top of WSL.
So please, go through the tutorial on the manual installation of WSL to check if all the steps are actually configured.
Before that, you can already check what version of WSL you have installed and its state, by running, in CMD or PowerShell:
wsl -l -v
After you set WSL v2 as your default version (Step 5 of the tutorial), you can make sure that Docker Desktop uses it. For that, check this link on the Docker Desktop WSL 2 backend, more specifically the Install section.
Regarding the make part of your setup, I believe that you can do that in a system of your preference. If you want to do that on WSL, I recommend you install Ubuntu running over your WSL (Step 6 of the tutorial).
Once you installed Ubuntu or other distro, you can run it as any other app. There, you can manage your apt, make and other installations right as in Linux :)

Having trouble installing Docker Desktop for Windows

I tried to install docker desktop but it giving me this error. WSL2 is installed and enabled in my desktop. Virtulization is enabled in my desktop. Please help me with this issue.
component communityinstaller.enablefeaturesaction failed: invalid namespace
Check this items :
Enable Virtual Machine feature
Download and Install the Linux kernel update package
Set WSL 2 as your default version wsl --set-default-version 2
Set your distribution version to WSL 2 wsl --set-version <distribution name> 2
Edit
If this method does not fix your problem, you might need to use This PC Reset.
Prepare the lastet install file(download from official website)
Go to Windows Services (you can launch by services.msc)
Find out the service "Docker Desktop Service", then stop it manually.
Execute the install file you prepared.
Expected it will install well.
ref from my blog Docker Desktop Upgrade Failed

Resources