Docker Failed to Initialize on Windows - docker

Here, I have problem regarding pulling docker-dev in docker image for making my development environment but when I tried to pull docker-dev. I got the error like docker manifest not found.
Can anyone help me out with this error...plz
before this
I want to know about the docker failed to initialize error which i'm having right now...
the error is like,
I tried so many things like re-install the docker desktop or WSL updates, but didn't worked.
And error in the command be like...
So if someone can help me out with this....plz help me out

Got the same issue and fixed it by deleting %appdata%\Docker as mentioned by Github User "tocklime"
(Original Source : https://github.com/docker/for-win/issues/3088)

Short solution: delete %appdata%\Docker\settings.json and let Docker to create a new one.
Take a backup of the file for the next time it gets broken.
<tl;dr>
I face this issue almost every month and I hope this will get fixed definitely.
Following tmBlackCape answer, I checked the %appdata%\Docker directory and found settings.json damaged (editor tells it's a binary file and of course it shouldn't).
I deleted the file and Docker Service (still running) created a new one with default values. If the service isn't running, just launch it again.
You could need to change settings (via GUI, as recommended) to catch your needs.
I made a backup copy of my custom settings.json so next time I can replace the broken one without losing custom configuration.

Go to the directory C:\Users-------\AppData\Roaming\Docker and delete the file settings.json . Docker takes care of rewriting it at startup.
This manipulation solved the problem for me !

Docker failed to initialize
C:\Users[USER]\AppData\Local\Docker
C:\Users[USER]\AppData\Roaming\Docker
C:\Users[USER]\AppData\Roaming\Docker Desktop
Once deleted above directory, I didn’t have to do anything else, Docker Desktop started booting up as normal.

The error message I got was not exactly the same the OP got. For me, it said Docker failed to initialize. Docker Desktop is shutting down.
TL;DR
The powershell executable was missing from my local machies PATH. I had to add C:\Windows\System32\WindowsPowerShell\v1.0 and docker started again.
The longer story
I tried everything that was mentined in this thread and nothing worked for me. When I looked at the task manager of my local machine to see if any docker-related process was started, I noticed that Docker Desktop.exe itself was started. However, the com.docker.backend.exe not. Docker tries to start that exe in an infinite loop, but as soon as it started it crashed again after half a second.
I then took a look into com.docker.backend.exe.log, which is located in %localappdata%\Docker\log\host and noticed the following line:
[2022-07-07T10:46:57.936079700Z][com.docker.backend.exe][F] exec: "powershell": executable file not found in %PATH%
I then went ahead and just added the path to powershell to PATH (which is C:\Windows\System32\WindowsPowerShell\v1.0)`. As soon as I added that, everything started working again.
I have no idea how the path to the powershell executable got removed from PATH. I certainly did not do that myself.

This happened to me after Docker Desktop upgrade to version 3.6.0 (67351), too. (Which was surprising, because it worked before the upgrade.)
Due to the help in the top answer right now, I went to the above settings directory: %appdata%\Docker, looked at the logs and deleted/renamed the file settings.json -> Docker Desktop started immediatelly ; there had been a process retrying in the background.
In the time before that, the backend.exe.log had been all "unmarshal" something something:
settings.json: json: cannot unmarshal bool into Go struct field Content.proxyHttpMode of type string"
common/cmd/com.docker.backend/internal/settingsloader.GetSettings(0x0, 0x0, 0x0)
So, the above message 'tipped me off' as to where the actual error on start may be. Hmm...

For me the solutions here didn't help, but here's what helped.
Make sure the folder .docker/ in your home directory isn't marked as hidden in Windows. If it's hidden, Docker won't see it.
Make sure docker has Active Directory to .docker folder. For example, if the owner of .docker/ is SYSTEM and not your user, Docker won't be able to read it and crash.

For me deleting the folder %appdata%\Docker did not work.
Instead I had to run the following power shell command as admin.
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
References.
https://stackoverflow.com/a/63845592/1977871
https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v#enable-hyper-v-using-powershell
My windows features with running docker desktop are as follows.

It resolved me by deleting the file
C:\Users{username}\AppData\Roaming\Docker\settings.json

I had the same issue. I'm on Docker Desktop 4.8.0. The following solution worked for me:
Uninstall Docker Desktop
Delete .docker folder from C:\Users\{Username}
Delete Docker folder from C:\Users\{Username}\AppData\Local
Delete Docker folder from C:\Users\{Username}\AppData\Roaming
Delete Docker folder from C:\Program Files
Run CCleaner on Registry and Custom Clean
Restart Computer
Install Docker
Restart Computer
Start Docker
That's all.

Go to C:\Users\asd\AppData\Local and delete Downloaded Installation directory.
C:\Users\asd\AppData\Roaming and delete Docker and Docker Desktop directory.
Then start docker.

Didn't found the AppData folder in users[myUser] or anywhere. re-install solve it for me

latest update 4.10.1 has issues, i downgraded to 4.6.1 and it worked however i think powershell is closely linked to this issue

It happened due to local data corruption. You can check in VM log inside %appdata%\Docker.
I was able to reset and restart by renaming setting.json and then restart the Docker desktop by deleting all the previous log folder and temp folder clean. If this does not help.
Try to kill all the processes running in through the task manager
and then run Power shell in administrator mode and then shoot the command if you are using an older version of Lsmanager Restart-Service LxssManager.

On my side, uninstalling HyperV did the trick :
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor
I also (as suggested in the voted answer):
Uninstalled docker desktop,
Deleted any docker related content in %APPDATA% as suggested
Delete any docker related keyys in registry (may be not necessary)
Then reinstalled it
And it solved the problem (but without hyperV removal it didn't work).

There are a few great solutions; however, it didn't work for me. Most of the "fixes" suggested here are already implemented and it just didn't work. I chose a different approach.
I looked at the docker releases and saw what was actually affected by their latest version not working (4.10). These things are normal, especially if the software engine has been updated.
Going through Docker releases, the latest release that didn't touch the Docker engine is 4.8.0. I downloaded and works great.

Removing settings.json file or %AppData%\Docker folder did not work for me. After uninstalling/installing the docker, the issue was solved. (Note: I couldn't try other possible solutions that are required the admin privilege)

The below Steps worked for me,
Step 01:
Navigate to the below-mentioned paths and delete the below-mentioned directories,
C:\Users[USERNAME]\AppData\Local\Docker directory
C:\Users[USERNAME]\AppData\Roaming\Docker directory
C:\Users[USERNAME]\AppData\Roaming\Docker Desktop directory
Then restart the docker again
If you didn't find the AppData folder in users[USERNAME] or anywhere
Step 02: Type the below path in the "Run" to directly open the app data location for you
%appdata%\Docker
Then Delete the below-mentioned directories,
C:\Users[USERNAME]\AppData\Local\Docker directory
C:\Users[USERNAME]\AppData\Roaming\Docker directory
C:\Users[USERNAME]\AppData\Roaming\Docker Desktop directory
Then restart the docker again
Note: If these steps do not help you. Try to kill all the processes running in through the task manager. And again delete the directories and start the docker

if you still can't find the issue you may use this trick and i'm 100% sure this will work
first check your operating system is up to date means no remaining updates if you pass this step then come to 2 step open window command prompt in run as administrator
then type wsl --install then type wsl --list --online then wsl --install -d Debian
then open docker if error come
then install wsl 2 linux https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package
then restart docker or your machine and then if error also occur then type then wsl --update i hope this will work Regard : Hammad Khadim

Related

Docker Desktop on Hyper-V - bind mount do not propagate inotify on file copy

I have a Docker Desktop installed on my dev machine, with WSL 2 disabled. I have shared my entire C:/ drive:
Then I have a container that inside has a .net 6 (Core) application that uses the FileSystemWatcher to observe one directory, and when a file is pasted inside to read it.
I red in several articles in the internet that WSL2 do not support notification to propagate from the Windows file system to the underlying Linux distribution that docker is running on, hence there is no way that I can bind the directory that I have to "watch" with the app in the container. So I swithed to the old Hyper-V support of docker.
I run the container with the following command:
docker run `
--name mlc-importer `
-v C:/temp/DZBank:/opt/docker/mlc_importer/dfs/DZBank `
-v C:\temp\appsettings.json:/app/appsettings.json `
-v C:\temp\log4net.config:/app/log4net.config `
mlc-importer
The container starts and starts "watching" for new files. The strange thing is, that when I cut a file and paste it in the directory, the app in the container registers the new file and reads it, but when I copy the file and paste in in the directory, the app in teh container do not register it and read it.
Can someone help me because I can't find out what the problem might comes from.
Thanks in advance,
Julian
I managed to solve mu problem, and I'll post it here if somebody encounters the same problem.
The problem was in teh file itself. This I found out when I started a new container with only debian, and installed inotify-tools, and binded the same path. When I tried to copy the file and paste it in the binded dir the output was:
Three times MODIFY event.
When I tried to cut the file and paste in in the new dir the events were:
So with copy - three times MODIFY, with cut one CREATE and two MODIFY.
Then I inspected the copied file and saw this:
When I checked the checkbox and hit ok, everything is ok. And since in the container app (from the post), I hook to only "File created" callback, it not triggers when the file is only modified.
Hope this helps someone with a similar problem

Need to remove symbolic link I created for /var/lib/docker/ but can't find it. Unable to use docker and feel helpless

I'm feeling really terrible atm so any help would be really appreciated. I kept running out of space when downloading docker images on /var, so I decided I needed to change the location for where docker was installing images. I tried several methods but had no success. First, I tried creating daemon.json in etc/docker and mapping data-root to a place with more storage (data2/docker). I stopped docker, moved everything over, made the file, but no dice. The docker daemon wouldn't start.
Then, I saw this method https://stackoverflow.com/a/49743270/13034460 which involves creating a symbolic link between /var/lib/docker and the new directory (data2/docker). I followed his instructions:
Much easier way to do so:
Stop docker service: sudo systemctl stop docker
Move existing docker directory to new location sudo mv /var/lib/docker/ /path/to/new/docker/
Create symbolic link
sudo ln -s /path/to/new/docker/ /var/lib/docker
Start docker service
sudo systemctl start docker
Well, this didn't work for me. I can't find the error message b/c it's too far up in my terminal, but it was along the lines of "you don't have enough storage/we don't know where to store this image". /data2/docker should have tons of storage so that can't be the issue.
But the big problem now is that this symbolic link exists and I can't figure out how to get rid of it. I tried removing everything related to docker on the computer, uninstalling, then reinstalling docker (which always used to work for me if there were any issues). But when I reinstall, it won't even run docker hello-world b/c of the link (I think). I get a message:
docker: open /data2/docker/tmp/GetImageBlob289478576: no such file or directory
So...it's looking in data2/docker because of the symbolic link (I assume), but that directory doesn't exist anymore. But neither does /var/lib/docker! All I want is to delete this link and get everything back to fresh defaults. I can worry about the storage issue another time. If I can't use docker at all, I'm so screwed. I've tried looking in every directory to find the link using -ls -l, but I can't find it. I used the exact code that the above references when I created the link (just my paths instead).
I would be so grateful to anyone who could help--I'm so lost on this. Thank you!

Composer Docker image won't run at all

I'm attempting to learn how to create a Laravel Docker image by following a tutorial on DigitalOcean using WSL. Following the instructions on the Docker Hub page, however, yields an error:
❯ docker run --rm --interactive --tty -v $(pwd):/app composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 94 installs, 0 updates, 0 removals
- Installing voku/portable-ascii (1.4.10): Failed to download voku/portable-ascii from dist: Could not delete /app/vendor/voku/portable-ascii/src/voku/helper:
Now trying to download from source
- Installing voku/portable-ascii (1.4.10):
[RuntimeException]
Could not delete /app/vendor/voku/portable-ascii/src/voku/helper:
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
How can I diagnose what I'm doing wrong?
It turns out that the underlying problem had nothing to do with Docker at all. In fact, Composer was trying to tell me what the problem was all along, but I dismissed it as just a symptom of a deeper issue:
[RuntimeException]
Could not delete /app/vendor/voku/portable-ascii/src/voku/helper:
This message was the crux of it all. I noticed that the directory mentioned, [...]/helper, was empty, so I tried to remove it by hand with rmdir. Instead, I got a No such file or directory error message. I attempted many other was to kill this directory, the entire project directory with rm -rf ~/laravel-app from the home folder, etc. Nothing worked.
Some digging around on the internet suggested that it could be an NTFS corruption if I was running into this issue on Windows. Since I am, indeed, attempting this on WSL (Windows Subsystem for Linux), I gave their suggested fix a try: running chkdsk /F in CMD/PowerShell. A reboot was necessary to complete this task, but after getting everything back up and trying those first few tutorial steps again, I was able to get composer to install the Laravel dependencies without a hitch.
Bottom line: If you run into this sort of issue on WSL, please try running chkdsk /F and reboot. You might just have a similar file system corruption.
We have two possibilities for this error:
1 - You did not execute the command inside the directory :
cd ~/laravel-app
2 - I'm sure there is an internal proxy that is blocking the download of packages.

Windows doesn't recognize Docker command

I already installed Docker for windows. when I type docker --version command in Command prompt, it doesn't recognize it at all.
The message will be this:
'docker' is not recognized as an internal or external command,
operable program or batch file.
Did I miss something ?
I had installed Docker 18.06.1-ce version on my Windows 10 machine and faced the similar issue, even though the docker was added the Windows %PATH%.
I moved the docker path to the bottom and that solved my problem.
I restarted the system, it worked, maybe we can say that a restart is required.
You need to start the docker first if you have not and then open powershell.
In the powershell, try to run docker commands.
I installed docker Docker version 19.03.13 build 4484c46d9d, in Windows 10 pro 1903.
I was facing the same issue, then I just renamed 'com.docker.cli' to 'docker' and set the environment variable to 'C:\Program Files\Docker\Docker\resources\bin'
Problem Resolved.
Refer the image:
https://drive.google.com/file/d/1sZwx4udOzJeITV2RDGQKlsOt_TF4Wq2N/view?usp=sharing
https://drive.google.com/file/d/1DpW2DR2n_jCGezwrXuhNtXpSTBWmEDJk/view?usp=sharing
Renaming 'com.docker.cli' to 'docker' helped me finally get windows powershell and cmd terminals to recognize the docker command.
Add docker to PATH variable & refreshenv to keep using the same command prompt
If you've installed using docker toolbox the install path "C:\Program Files\Docker Toolbox"
Manually using Environmental Variable > Path (add docker path here)
Using Command Line
For temporary use set PATH=%PATH%;C:\Program Files\Docker Toolbox
Make sure to take a back up of PATH by echo %PATH% before doing this
For permanent change setx PATH=%PATH%;C:\Program Files\Docker Toolbox
docker: command not found
Windows 7: Just set the path of docker in system variable
Step:1
[Click on path -> edit-> paste the docker location]
Step:2 [Paste the docker location]
In my case C:\Program Files\Docker Toolbox.
now check $ docker version
Make sure the docker.exe path (C:\Program Files\Docker\Docker\resources\bin) is added to the PATH variable.
You can check it as follows:
ECHO %PATH%
The docker path had to be appended at the end of the PATH in my case. After that docker cmd was recognized.
Run as administrator worked for me, both powershell and bash on windows. I did not need to restart.
I checked environment variables and noticed that docker path is as the following path in which "R" in resources uppercase. I fixed the case and everything worked as expected
Path: "C:\Program Files\Docker\Docker\Resources\bin"
Just Restart the system, it is always good practice to restart the system when you install or uninstall any application. Hope this works :)
For those who are facing docker issue on VS Code
I was trying on VS Code Terminal after installation. Restarted and was still facing issue.
Then I tried with fresh terminal of Command Prompt -- it worked!
After that it also working fine on vs code.
In VS Code - close all terminals and open fresh terminal
and try test command:
docker --version
2022 - Windows 11
Add these paths to the PATH variable.
C:\Program Files\Docker\Docker\resources\bin
C:\ProgramData\DockerDesktop\version-bin
Docker PATH variable Windows 11:
You need to restart the system after installation. It worked for me.
Try to install GIT bash and then run this command on it for Windows:
base=https://github.com/docker/machine/releases/download/v0.16.0 &&
mkdir -p "$HOME/bin" &&
curl -L $base/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe" &&
chmod +x "$HOME/bin/docker-machine.exe"
Click Here.
there is some issues with PowerShell or new version of docker due to which I was facing the same issue but then I went to this page and got way to run it.
PS: GIT bash is required.
If you have installed Docker Toolbox in your windows, go and add the environment variable.
PATH = "location of folder that contains docker-machine"
I also face a problem with the installation and running docker. I'm not sure you how did you install docker. I tried this way. I've downloaded the docker toolbox (https://github.com/docker/toolbox/releases) which comes up with docker,docker-machine. Oracle Virtual box which is pretty much enough to start docker locally.Please make sure you have git bash installed in your local. Once the toolbox installation is done click the icon generated on the desktop . Make sure this icon target to your Git bash.exe (you can verify this by right click on icon and find target). and verify docker version
For me, I had to ensure the check box Enable Hyper-V Windows Features is checked as I was installing.
I just wanted to have client installed, without the engine. So earlier, as I was installing, I unchecked that option. And after successful installation, I get the error - windows does not recognize docker.
But now that reinstalled with the checkbox checked, things are working fine now.
I noticed that running docker commands before startup causes this issue, but ensuring that docker is running and executing the commands after, they are then recognised.
I facing the same issue when I try to run docker -v in Vscode Terminal after install it. I try to use cmd and git bash it work fine. Restart your vscode will solve it
Unfortunately, After many tries and restarts, I uninstalled docker and Re-installed it again, and I had to build all things again.
I faced the same problem, them I tried in Powershell which works someHo
Download "docker-machine-Windows-x86_64.exe" from: https://github.com/docker/machine/releases
Rename "docker-machine-Windows-x86_64.exe" to "docker-machine.exe".
Copy "docker-machine.exe" to path C:\Program Files\Docker\Docker\resources\bin.
just add this path in your "Path" inside env variables inside windows
C:\Program Files\Docker\Docker\resources\bin
then restart your gitbash or cmd or ...
everything goes well after that !
*just add in your environmental Path this syntax if you did like (install docker in c drive) me, most probably it would work, for me, this passed well.
(note: if you going to call RefreshEnv.cmd or RefreshEnv
through your CMC with Chocolatey, this path would not be created for you, and you have to do it manualy in Windows 10 operating system).
C:\Program Files\Docker\Docker\resources\bin
In my case, I switched to the windows command prompt instead of the VScode terminal.

Docker-compose throwing error

Hello guys I'm trying to get my vagrant up but the docker keeps on throwing an error which is given below :
Can't find a suitable configuration file in this directory or any parent. Are you in the right directory
The file is present at the root of my project. It was all working well but it just started to throw an error. Can somebody tell me what is it that I have done due to which I'm getting this error
well, I had this error but it was due to vagrant. If you are running vagrant then first of all enter into your vagrant machine using :
vagrant ssh command
and try to find the file over there. If you don't have it over there then this is the problem. That file is not being loaded over here because of which you are getting this error.
My error was coming because vagrant was not mounting the nfs partition because of which the whole project was not loading in the vagrant machine and after that, the docker command was being run. Since the project was not being loaded docker command was not able to find the required file.
If this is your problem try to mount your nfs partition first.
Run:
docker-compose -f rootoftheprojectpath/docker-compose.yml up -d
Check read permissions, typos, etc. Also check that your file is not empty
Regards

Resources