I can't initialize docker on Windows 10 - docker

I installed docker version 20.10.11 on my Windows 10 home with build 19042, the installation was successful, but when running docker, the daemon was not started, so I manually installed wsl2 using this tutorial.
https://nlearn.microsoft.com/en-us/windows/wsl/install
Now when executing any docker command via cli, it shows this message
"Server:
ERROR: error during connect: In the default daemon configuration on Windows, the docker
client must be run with elevated privileges to connect.: Get
"http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/info": open //./pipe/docker_engine: The
system cannot find the specified file.
errors pretty printing info"
I've followed all the tutorials from this link
Docker cannot start on Windows, none of them worked.
When I open the Docker Desktop dashboard, it shows the message docker starting engineer, or something like that, it keeps initializing, but it never finishes initializing.
Virtualization is turned on, when I open processes I notice that docker.service is running and a process called Vmmem, when I look at all the services even the ones that are not running. There's only one, which is the Docker Desktop referring to the docker
Ps: I don't know other programs may be interfering with it, I have an oracle 18cxe database running on my machine, I don't know it's interfering with a network connection or something.
I would like to know how I can get an accurate log, to know what the problem really is, how do I trace this error?

Related

Docker Desktop is shutting down and Docker failed to initialize

I'm trying to install Docker Desktop onto my Windows OS. I have WSL 2 with Ubuntu already set up and have the Virtual Machine Platform also checked in the windows features. My OS build is 19043.1766 which means it should work, and I have tried deleting the Docker related information in the App Data folder to no avail. The first time I installed it, it asked me to log out. Ever since then no matter if I reinstall or restart it will always say Docker failed to initialize. This is my first time downloading it and I have never been able to open the program.

"Docker Desktop Starting..." forever on Windows

I have installed Docker Desktop version 4.4.4 and it is not running. It only displays "Docker Desktop Starting ..." but never starts running.
I have tried so many ways but didn't solve:
Allowing the following files in windows firewall C:\program files\docker\docker\resources\vpnkit.exe, C:\program files\docker\docker\com.docker.service C:\program files\docker\docker\resources\com.docker.proxy.exe
Removing 'Docker' and 'Docker Desktop' folders from AppData/Roaming and AppData/Local
Uninstalling and reinstalling Docker with different versions including 4.5.1
The main problem is WSL2 does not auto install the kernel when WSL2 installs, yet Docker Desktop expects it already installed. So, fully close & stop Docker as other answers have said, then run this cmd as admin:
wsl --update
Now open Docker Desktop & it should start up ok.
I've found out another symptom leading to the solution is also related to WSL.
On one side, Docker service won't start throwing this error:
error during connect: This error may indicate that the docker daemon
is not running.: Get
"http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/version": open
//./pipe/docker_engine: The system cannot find the file specified.
And on the other, WSL is unresponsive. Attempting to run a WSL Distro or WSL command directly on CMD, won't return any output at all. It will just hang in there.
So the solution is common to WSL and Docker.
I've found in a question regarding the WSL issue, that the LxssManager Windows service is staled (it may show under services.msc as Stopping and all the buttons are greyed out, or I've even seen it Running apparently, but with the Docker and WSL issues above, so something is wrong with it still.)
First, we have to get LxssManager PID in order to kill it. Using an elevated shell, we can get it this way:
sc queryex LxssManager
Having the PID, we can kill the process but beware I wasn't able to kill it using kill or taskkill commands. I was getting the following error:
ERROR: The process with PID XXXXX could not be terminated.
Reason: Access is denied.
To effectively kill the process, do as following:
wmic process where ProcessID=XXXXX delete
Replace XXXXX with PID, of course.
Having done so, start the LxssManager service:
net start LxssManager
A word of warning:
I've noted in some cases this is not enough for unknown (to me) technical reasons even if LxssManager service is shown as Running.
Just repeat the above steps! Sometimes it works doing this once, sometimes doing it twice for some reason.
TL;DR
Kill LxssManager Windows service using wmic+PID.
Start LxssManager service.
Repeat twice or more if issues persist.
Docker and WSL issues are solved.
Here i am using Windows platform, I faced this issue.
And to resolve this issue follow the below steps.
Just delete the temporary files from the following.
C:\Windows\Temp
C:\Users{yourAccountName}\AppData\Local\Temp
C:\Windows\Prefetch
then
Uninstall Docker Desktop
Restart computer
before installing docker, make sure you have Ubuntu WSL(download from Microsoft store)
[optional] If you need Terminal Preview(multi-terminal) download from Microsoft Store. Great Terminal
Install Docker Desktop Again
Thanks
For me, it was a problem with WSL. When I tried:
wsl --install -d Ubuntu
in a command window, after a few minutes I got error 0x80370114
The fix was to do:
Exploit Protection > System Settings > Control Flow Guard
turn on
restart computer
Then reinstall/restart Docker Desktop, and it works!
Hope this helps someone else
I was facing same code for for Docker version 4.*. For me it was Visual Studio code,
Stopped WSL form Task manager
stopped Docker which was showing "Docker desktop is starting" form Task manage
stopped Visual Studio code form Task manager
Started Docker again
These steps placed my Docker in Running state in 30 seconds
Hope this helps someone!
Solved this issue with #Alvi answer
Docker forever in "Docker is starting.." at Windows task
I guess you are using wsl2 features. In that case, open PowerShell or command prompt and type: optionalfeatures.exe
scroll down and uncheck
Windows Subsystem for Linux
apply the changes and restart your computer.
After restart follow the previous steps again and check
Windows Subsystem for Linux
and restart again. Hopefully now your docker will run
My fresh install was experiencing the same symptoms. Also wsl --list showed "no installed distributions". I tried many reinstallations and restarts of Docker and WSL, but eventually found the steps:
In Task Manager, kill all processes related to Docker & Docker Desktop
Run Docker Desktop as administrator
Got it working on on Windows 11 Enterprise.
for me it worked in windows (docker desktop):
to uninstall the docker
reinstall as administrator
don't select the part with wsl
As wrote here, you need to do:
wsl --update
But after that it doesn't fix my issue until I did restart to my pc.
What worked for me was to log in into the Docker (upper right corner), but when I first clicked on login, it said "exec: "rundll32": executable file not found in %PATH%" - I search and found that I need to check environmental variable in PATH that I have "C:\WINDOWS\system32" there - (and in my case I really had it broken somehow - don't know why, but I missed backslash between Windows and system32). So I fixed to correct path, restarted PC. Then I was able to login. And immediately "Docker Desktop Starting..." was gone.
I use Docker with PyCharm. I ran into this problem when I launched PyCharm and Docker Desktop at about the same time.
On my machine Docker Desktop starts automatically when I boot. I can avoid the problem by waiting for Docker Desktop to finish starting. And then start PyCharm.
I was also having the same problem, just a few minutes ago.
Platform:
Windows 10 Pro - 22H2 - Build 19045.2486
Windows Updates newly installed: KB5022282, KB5020876, KB5012170
What i did was: Activating the Windows Hypervisor Platform
And it did solve the problem, atleast for now
In my case it helped me to enable the CPU SVM (Support Vector Machine) function in my BIOS settings.
Also, if you have this feature disabled, you will not be able to use Virtual Box either.
SVM in BIOS
got to services and stop Docker desktop service and start again
reopen Docker desktop it will work
wsl -v
if it show version then linx is install
search windows programer feature in your laptop
enable virtulization
wsl --set-default-version 2
restart laptop and then start docker and wait for 2 minutes your docker will start working
I am running windows 11, visual studio 2023 and had this issue.
First, open a command prompt and type
wsl.exe --list --online
Then enter following
wsl.exe --install Ubuntu-20.04
Then type in the prompt sudo apt update to update the distribution. Lastly, start up Docker desktop and log in (you can register at their site). That fixed Docker on my pc.

Pycharm attach to process inside a container causes accept timeout

I am using pycharm professional 2021.3.1 and ubuntu 18.04
I can attach to any process running directly on the host
However if the process is running inside a container (no matter what host privileges' I gave it)
I cannot attach. I get the following error
"Connection to python debugger failed Accept timeout'
I Tried on another computer and got the same results
Is this a known issue? Are there any work arounds? Except for using remote debugger (which requires adding extra code to the production code)
I found a way, it is not documented (as far as I can tell) but since it is for debugging only I will continue with it
Pycharm Professional set the IDE like you would for remote debug server
https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html#remote-debug-config
In the docker file of the containers that you wish to debug always install:
gdb
pydevd-pycharm
After the container and the process is up go into the container and run
"python3 /usr/local/pydevd_attach_to_process/attach_pydevd.py --port port_set_in_pycharm --pid pid_of_process_to_debug_in_container_id --host ip_of_the_host_running_the_pycharm"
the following is the same command pycharm uses when you do attach to process
now you can put breakpoints and debug normally
Advantage of this solution in contrast to remote debug defined in the pycharm documentation is that we do not have to add code to the production code

How do I uninstall Docker or remove the Docker directory?

I am trying to learn Docker and have installed it on my laptop. I have tried to uninstall it and delete the Docker directory as Administrator, but keep getting the error message "The action cannot be completed because the file is open in Docker Desktop service". But Docker Desktop Service is not open, and does not appear whenever I open Task Manager. When I try to reinstall Docker, it says it it up to date, when clearly it is not. I would appreciate any help getting a fresh installation of Docker.
Here is the Docker directory C:\Program Files\Docker\Docker.
Here is the error message.
If you have access to the windows machine, through UI, you can:
Go to Start -> Services, and search for the Docker (probably is called Docker Desktop or something similar) service and
Manually Stop. You can also set the service to start Manually, not Automatically, give a restart and
Now Docker is completely stopped and
You can uninstall safely.
User azbarcea answered the question.

Running Docker locally in browser on Windows10: Error - IP Not Found

Ok, so here's my background first. I'm a noob in the world of commandline interfaces, but have been building websites off and on for a long time (10 yrs) using GUI's. So, I'm trying to make the switch to CLI's while also learning Docker.
Right now I'm stuck at trying to get Docker to load anything into my browser window. Here's what I've done successfully:
Installed Docker CE on my Windows 10 Machine
Setup a new virtual switch in Hyper-V Manager per these instructions and restarted the computer.
Created a new machine using this line of code docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" manager1
Now here's where things get a little interesting. When I run the above function (I've done it twice now) it stalls on the line: Waiting for host to start...
I waited for five minutes to see if it would do anything, before killing the operation. (oh, did I mention I'm running PowerShell in Adminstrator Mode - right click on the icon to "run as administrator").
So when I re-open PowerShell to check if the new "manager1" machine has been created it comes back affirmative, but with this:
PS C:\WINDOWS\system32> docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
manager1 * hyperv Running Unknown IP not found
As far as I can tell these are the steps that I need to take to get Docker to run locally in my browser window, but for the life of me, I'm lost!
Oh, I did downgrade my docker-machine version per a suggestion that I read in a git forum comment, but that was to remedy an issue with the docker-machine create command. Part of me wonders if I'm doing too much. But I honestly don't know what to do next.
UPDATE:
I don't know that this is progress, but in the Virtual Switch Manager, I did switch the external network device from the "Ethernet Connection" to the "Dual Band Wireless" option. Then I restarted my machine. Now I'm showing that the state of the machine is "Timeout". I've also started and stopped my "docker-machine manager1". It sites on the (manager1) Waiting for host to start... line for about half a minute, then proceed to the Waiting for SSH to be available... where it just sits. Here's another screen shot that captures this:
Ok, my confusion was a result of looking beyond the documentation and getting a little confused. I still don't have this fully figured out but everything I was attempting to accomplish is detailed in this getting started with Windows 10 pro article.

Resources