Docker: WSL 2 integration with distro Ubuntu 20.04 unexpectedly stopped with exit code 1 - wsl-2

My docker environment was working fine. I restarted my system and it stopped unexpectedly. whenever I try to start docker it throws the following error
WSL 2 integration with distro Ubuntu 20.04 unexpectedly stopped with exit code 1.
I am using the following versions
Windows 10
Docker Desktop 4.6.1
WSL 2
List item
.wslconfig (memory=8GB, processors=4)
I have tried following patterns to make it run
restarted docker and windows many times
done with wsl upgrade > sudo apt update && sudo apt upgrade -y

I had the same issue when updated docker desktop with WSL2 backed has a work around I did the following steps:
In docker desktop settings i enabled again the "enabled integration with other distros"
Apply and restart the changes then stop Docker desktop.
Enter to Settings -> Apps and search for ubuntu
Click on Ubuntu and advanced settings
Select repair
Restart the computer
After computer starts enter to the ubuntu wsl via console or terminal
Start docker desktop
Try docker ps or docker-compose to check if the error was resolved.
Hope this helps!

Check for a system variable
Path - C:\Windows\System32
Maybe it will save you a few hours.

Please try this solution comes from todpale:
close Docker Desktop
restart Ubuntu through services.msc or this command (you can put in bat):
net stop LxssManager && net start LxssManager
start Docker again
You also may check if your distro is enabled in Docker settings (General tab and Resources tab -> WSL Integration).
There is a discussion about this issue on Github https://github.com/docker/for-win/issues/9972

Have the same problem. It solved after I add 'C:\Windows\System32' to path.
Try type wsl.exe or wslconfig.exe /l. If nothing happens than modify the path.

Unfortunately none of the solutions here worked for me. Steps to fix were:
Update WSL2 Ubuntu distro:
sudo apt update
sudo apt upgrade
Uninstall Docker Desktop on Windows
Reinstall Docker Desktop on Windows
Note that containers and volumes were lost with the uninstall.

I tried every answer here but when I'm starting docker was still facing the same issue.
So I started the docker without WSL after installation, then changed the setting to use WSL. Docker is working fine now. Hope this helps someone.

Just posting what worked for me. I was using a WSL distro that I restored from a previous Windows installation (named here ubuntu-restore).
Initially, I was able to get more information to debug my problem by running:
sudo /mnt/wsl/docker-desktop/docker-desktop-user-distro proxy --distro-name ubuntu-restore
And the console gave the following error (simplified):
[docker-desktop-user-distro in ubuntu-restore][I] mounting /mnt/c/Users/no-longer-exists to /mnt/wsl/docker-desktop-bind-mounts/ubuntu-restore/b34c91da7c9e60d4983f67b84fe84fda955dbf79d010eb25ab0aaec28012fb5c
[docker-desktop-user-distro in ubuntu-restore][W] restoreMounts: ensure ready failed: mkdir /mnt/c/Users/no-longer-exists: permission denied
Which meant I had to clean up some old bind mounts that stayed in the distro. I found them in /var/lib/docker-desktop/mounts.data, removed them, and the WSL integration works again.

Related

Failed to open X11 display - How to execute SFML output on WSL - Load WSL GUI apps

have any of you tried compile and executing SFML c++ project output on wsl?
I tried and got
Failed to open X11 display; make sure the DISPLAY environment variable is set correctly
Aborted
Is it possible at all to execute GUI applications through wsl?
(I've installed ubuntu's for wsl)
Linux distributions set up for WSL 1 will not function with Linux GUI applications, which are only supported with WSL 2.
Due to the official documentation from Microsoft regarding WSL, you might need to check these steps:
Select Start, type PowerShell, right-click Windows PowerShell, and then select Run as administrator.
after that type this command and then press enter:
wsl --update
You will need to restart WSL for the update to take effect. You can restart WSL by running the shutdown command in PowerShell.
wsl --shutdown
now, once again open powershell and type in this command:
wsl --list --verbose
You should see the number 2 for your installed distro under the heading VERSION in the response.
If everything went as planned until this point, see if your distro can open any windows by installing a GUI app like gedit and trying to open it:
sudo apt update
now install gedit:
sudo apt install gedit -y
After the installation has finished, launch gedit by typing gedit in your wsl terminal. A window from wsl inside of Windows should now open, and the issue should now be resolved.
find more information here:
https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps
If you had the same problem
first, you need to install VcXsrv and X11 for executing GUI applications through wsl
then you have to add these 2 to your environment variables:
export DISPLAY=:0
export LIBGL_ALWAYS_INDIRECT=0

Copy file from container to local filesystem

History:
My docker build file worked for years, without any problem, on my Linux Mint VM. When I needed to recreate the VM, I installed everything again, including docker.io.
I'm taking a beating with this error. I already verified that the final file is inside the docker image, but when I try to copy it to a directory external to the container, it says that it does not exist.
I followed the guidelines at Exploring Docker container's file system and verified that the file was in fact in the container.
Environment:
Linux Mint 19 (Tricia)
Docker installed by snap
Command:
docker cp {CONTAINER_ID}:/container_path /local_path
Problem:
stat /container_path: no such file or directory
The solution was simply to uninstall the docker by snap and install it again by apt. This solution still lacks more information, as it is not known if the problem was really caused by the version of the docker installed by snap.
sudo snap remove docker
sudo apt install docker.io

XRDP doesnt connect to Azure VM suddenly

The RDP doesnt connect to the Azure Linux VM suddenly, the error is:
Password failed, error- problem connecting.
This is the first time its happening. And I tried restarting the VM, Resetting the password and also removing the credentials and adding again to the rdp. Please support on this.
I have encountered exactly the same issue on ubuntu 14.06 running on AWS today.
I checked the /var/log/apt/history.log and found out that the system updated the xrdp package automatically xrdp:amd64 (0.6.1-2, 0.6.1-2ubuntu0.1)
I downgraded the package and it now works again.
sudo apt-get install xrdp=0.6.1-2
Then, I decided to exclude xrdp from automatically being updated.
sudo apt-mark hold xrdp
xrdp set on hold.

Jenkins Installation Wizard Error

I've tried installing Jenkins on AWS & DigitalOcean instances/droplets without any luck.
For EC2 instances used the latest Amazon Linux AMI (ami-f9dd458a) & Ubuntu 14.04 (ami-ed82e39e). On DigitalOcean I tried using Ubuntu 14.04 & 16.04. I've also attempted to install jenkins using jdk-7 & jdk-8 following Debian based installation or Red-Hat distribution installation instructions (even tried to install LTS version).
For all of the above the installation runs smoothly but after unlocking with the initialAdminPassword and selecting either option in the wizard ("Install suggested plugins" or "Select plugins to install") I face a connection (?) error:
I copied the logs from /var/log/jenkins/jenkins.log and they are in this gist.
Could this be a dumb mistake I did along the way? I've used Jenkins from a docker container but kinda need to install natively now for. Thanks for the help.
Solved: Install on an instance with more RAM.
For some reason I had no problems installing in a smaller machine using the docker image. Oh well :)

Tips on getting docker to work without having to run `sudo docker -d` on Ubuntu 15.04

After upgrading my system from 14.10 to 15.04 I can't seem to use docker like I used to. I already have a docker group that my user is part of and I used to be able to use docker without sudo just fine. Now I can't use it unless I have sudo docker -d running in another terminal. Simply running docker ps gives me this error:
FATA[0000] Get http:///var/run/docker.sock/v1.18/containers/json: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
I've tried reinstalling, rebooting, restarting services, and blowing out configurations to no avail. Any tips would be appreciated. As a side note, I installing 15.04 in a vm to see if I could get docker working there and I was able to set it up no problem. seems like an issue specific to those who have upgraded from 14.10.
Did u checked this http://docs.docker.com/articles/systemd/? This helped me to start docker under Ubunu 15.04.
What to do if this fails...
$ sudo usermod -aG docker $USER
..and you have added user to docker group and Ubuntu still requires sudo:
If you initially ran Docker CLI commands using sudo before adding your user to the docker group, you may see the following error, which indicates that your ~/.docker/ directory was created with incorrect permissions due to the sudo commands.
To fix this problem, either remove the ~/.docker/ directory (it is recreated automatically, but any custom settings are lost), or change its ownership and permissions using the following commands:
$ sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
$ sudo chmod g+rwx "$HOME/.docker" -R
What the link mafahand provided tells is how to use docker on a systemd based host. Ubuntu 15.04 uses systemd now while older version used upstart. That might explain why upgraded systems show erratic behavior. Check out the Ubuntu wiki for some help on that regard.
After installing docker via
sudo apt install docker.io
you might have to reboot your system or start the docker.socket unit manually. For some reason that did not happen on my machine after installing it.
Type
systemctl status docker
to check whether docker is up and running. If it is not enabled use
sudo systemctl enable docker
to enable it permanently and/or
sudo systemctl start docker
to run the service.

Resources