Not able to start docker Desktop in Windows - docker

I am not able to start the Docker container in Microsoft Windows 10 profession. As I found the cause of this error is due to the docker engine is failing to start.
After installing docker I am able to run only the docker version command.
-> docker --version
As I found the error which is showing docker daemon is not running in windows while running any other docker commands on CMD.
I also enabled (checked) the Hyper-V option in "Turn Windows features on or off" in the Control panel -> Programs -> Turn Windows features on or off.

The error is related to the daemon part:
In the default daemon configuration on Windows, the docker client must be run elevated to connect.
We can switch the Docker daemon as an elevated user in order to run the docker daemon in the Windows professional:
Run below command with Windows Powershell as administrator:
Run the PowerShell command: -
& 'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchDaemon
OR
You can run the below command on CMD as administrator:
Run the CMD command: -
"C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchDaemon

My Docker Desktop failed to start after I forced it to exit while updating (it stuck during the update that's why I had to do it). No solution on the Internet helped me until I ran into this Powershell command:
wsl -l -v
It listed the following:
* Ubuntu-18.04 Stopped 2
docker-desktop Uninstalling 2
docker-desktop-data Stopped 2
It kept saying "Uninstalling" even after rebooting the whole system.
What I did was:
wsl -t docker-desktop
It terminated docker-desktop and made the problem gone.

delete %appdata%\Docker\settings.json and let Docker to create a new one

You should check WSL:
Execute "wsl -l -v" at the command prompt.
If the result is like this:
Then execute "wsl --shutdown" on the command line.
Then execute "wsl -l -v", you will see:
Then start Docker Desktop.
This solved my problem.

Make sure to download the Linux Kernel Update Package and then try restarting Docker Desktop.
Download from here

Just share my experience how I solved the problem with "docker failed to start" or similar problem. I found some mess with my Win10 Home edition, despite the fact that all checkes regarding Hyper-v, wsl and others passed I got failed to start docker engine. So, I tried to install one of the old version (4.4.4), not the newest one. An voila it installed wsl2 and started without any problems!
Hope this could help someone who's tried all solutions (for example, deletion of the %appdata%\docker folders) :)

I was getting the same exact issue and a solution was provided from thread The attempted operation is not supported for the type of object referenced." error after Windows Update fixed my problem. I had tried everything before this solution. To keep it simple just follow the below steps -
Copy below snippet
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog\0408F7A3]
"AppFullPath"="C:\Windows\System32\wsl.exe"
"PermittedLspCategories"=dword:80000000
Save it as a file wsl.reg
Execute the file to update the wsl registry
restart docker desktop
these steps are basically done to do some changes in the registry of wsl distribution that is installed standalone or by docker.

Using PowerShell gave me a right direction. All restarts and re-install with deletion didn't work.
wsl -l -v showed list of three processes but wsl -t docker-desktop responded with "There is no distribution with the supplied name." only. wsl --shutdown either didn't work.
Solution is next door wsl --unregister docker-desktop . After this all went fine.

I ran the following command which resolved the issue for me.
wsl --unregister docker-desktop

Please make sure your OS type requires WSL or Hyper-V to run docker as per this official link 👉 https://docs.docker.com/desktop/install/windows-install/
For my case, I am using Windows 11 Home OS, and it requires WSL (Windows Subsystem for Linux) to run docker. So that I installed WSL on my system.
Follow this link to install WSL 👉 https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package
After that restart your system, then open docker (It may take up to 10 secs to start)
Hope it may solve your issue✌️

Related

IOTA "one-click-tangle" via docker linux containers - ERROR 1

I am trying to run a private tangle on my computer through linux docker containers.
Therefore I followed the guide over at https://wiki.iota.org/chrysalis-docs/tutorials/one_click_private_tangle
Every step succeeded up until we tried to execute
./private_tangle.sh install
This reports
Error 1
as seen in the screenshot below:
We do net get any further information, is anyone familiar with this error, or has any clue how to get some more information on the error so that we can at least have a clue where to look?
Some further information:
After executing docker ps -a we see that not a single container is running.
I am running on a windows 10 machine
I execute the commands from within ubuntu (version 20.04)
Ubuntu, docker-desktop and docker-desktop-data are all running WSL2
Docker integration with ubuntu is activated
I thought the error could maybe come from no hornet node initially being installed, so I installed a hornet node successfully, according the guide that https://wiki.iota.org/chrysalis-docs/tutorials/one_click_private_tangle. This changed nothing to the Error.
The version of docker and docker-compose are compliant with the requirements
If any more details are needed to help me solve this problem, please let me know.
I used the documentation (https://wiki.iota.org/chrysalis-docs/tutorials/one_click_private_tangle) to install these containers on my local ubuntu 18.04.
My docker version is: 20.10.12
And docker-compose version is: 1.29.2
By following the steps of the tutorial I managed to successfully start all of the containers without trouble.
My guess here would be that the permission of the 'private-tangle.sh' are not correct or that there is permission problem on the docker level.
You should start with checking the permission level of the private-tangle.sh script by using $ls -l
Here is my output -rwxrwxr-x 1 ben ben 9413 Jan 11 11:28 private-tangle.sh
It could also be due to the docker rights if you have to use sudo when executing a docker command it will give some troubles when executing the script.
You need to add yourself to a docker group to be able to run docker commands without sudo. You can do this by running sudo usermod -aG docker $USER with damiaan-vh as $user.
Solution from source https://stackoverflow.com/posts/70665394/edit
Suggesting to downgrade ubuntu version to 18.04 for more stable version.
For reinstalling the docker and docker-compose programs follow this documentations
(docker: https://docs.docker.com/engine/install/ubuntu/ )
(docker-compose: https://docs.docker.com/compose/install/ )

error during connect: This error may indicate that the docker daemon is not running

I am new to Docker and after writing docker version in cmd I got 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.
The following steps solved this problem:
Open cmd as administrator
Launch command: "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchDaemon
some times docker might be disabled from starting on boot or login so in the windows search bar or when clicking the WinKey and starting to type Dock... like showen in the picture below, Then press Enter to start the Docker Daemon
Try running dockerd in a separate terminal and then try running this command.
To avoid doing this every time you can go to services -> find Docker -> select Startup Type as Automatic (Delayed) and reboot the machine.
Simple Solution: Just open Powershell and type dockerd which will start the daemon and you shall be able to use the docker now without errors.
On Windows, reason behind this issue is that Docker is not started. I tried couple of solution provided on multiple online portal to start it. What worked for me is:
In Docker Desktop if you are already logged in as a user, logout from there
Again login to docker desktop with docker account
When we login to docker account, it internally triggers the restart. So resulting if it's not started, it will start the docker for us.
I had this, but when I used a command shell elevated to Administrator, docker version was fine.
This error may indicate that the docker daemon is not running.: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json": open //./pipe/docker_engine: The system cannot find the file specified.
this error in windows 10
step 1
pls install (https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package) Download the latest package:
this link WSL2 Linux kernel update package for x64 machines
then restart then automatically running
In my case,
I download the this github repo.MaxySpark
Closed all the application related to docker.
1.Click on docker.reg file in the downloaded repo.
2.Click on yes->yes->ok to merge.
3.Again open the Docker Toolbox and run docker run hello-world
Open cmd as administrator
Launch command: C:\Program Files\Docker\Docker\DockerCli.exe -SwitchDaemon
It simply means that your docker application is not running or you have not logged in to docker application, or docker desktop service is not running .
1: Just open Docker desktop application, login with docker credentials.
2: if already logged in and still getting this error, go to windows + r ==> and type 'services.msc', and restart the docker desktop service.
All done.
It can be kernel problem:
You need to update WSL2 Linux kernel update package for x64 machines
Follow this tutorial:
https://linuxhint.com/resolve-docker-daemon-not-running/
and before execute "docker run hello-world" command, dont forget restart docker
https://learn.microsoft.com/en-us/windows/wsl/install-manual

Why am I getting a "Cannot connect to the Docker daemon" error in WSL2?

Here is my setup:
Windows 10 PRO - build 19041.153 - insider program - slow ring
Ubuntu 18.04LTS subsystem in WSL2 mode
Docker for desktop 2.2.0.4 - enabled WSL2 integration with my Ubuntu subsystem
I am currently forced to use Windows for development, so I became a
Microsoft insider member and installed ubuntu with WSL2 mode. Docker desktop supports integration for WSL2, so I tried it...
For a week it worked flawlessly. Today after a PC restart, I can't get docker running again. Ubuntu can see the injected binaries from Docker desktop, but it can't connect to windows hosted docker daemon anymore.
When I call in the WSL terminal docker info it returns
$ docker info
Client:
Debug Mode: false
Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
or with docker-compose up
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
What I've tried already:
expose daemon without TLS with envs like DOCKER_HOST=localhost:2375, DOCKER_HOST=tcp://localhost:2375, DOCKER_HOST=127.0.0.1:2375, DOCKER_HOST=tcp://127.0.0.1:2375 => same result
uninstall Docker desktop and install previous version
turn off windows firewall
I really, really need this to work. Thanks for any ideas. Weirdest thing is it worked yesterday and I didn't make any changes in system from then...
I know this may be outdated for the present question, but this should save us precious time, especially when Windows 20H1=2004 is going to Production this month (May 2020).
  Operating System Version: Windows 10 Education (Same as Enterprise and a superset of Pro).
  Version: 2004
  Build (Version OS): 19041.264
  Others: Windows Feature Experience Pack 120.2202.130.0.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Shell: WSL Terminal
First, I have installed WSL v1 previously, then executed the procedure to upgrade to WSLv2, and this error shows up: "ERROR: Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?".
Second, to fix that error, I followed instructions stated here: Link, and it worked.
Third, after some tests I think the missing change in the upgrade, was removing the DOCKER_HOST variable from shell's start script.
SUMMARY: In my case, the procedure for a permanent fix should be the following STEPs:
1. Test if it's your case unsetting DOCKER_HOST variable (See image below).
2. If the error disappears with previous step, then time to fix changes by removing the setting of the DOCKER_HOST variable in the shell's start script (In my case was *$HOME/.bashrc*).
  Commented this out:
  #export DOCKER_HOST=tcp://localhost:2375
  #export DOCKER_BUILDKIT=1
  NOTE: Also include DOCKER_BUILDKIT.
3. Close and open the Terminal.
  Test in Step 1:
Good luck!!
If it helps anyone else that is having this issue, for me it turned out that my subsystem was suddenly (and "on its own") ticked off in docker's RESOURCES > WSL INTEGRATION settings.
On the Docker Desktop app I had to manually enable my distro integration under
Settings > Resources > WSL Integration
I had installed Docker for Windows, as recommended, to use it with WSL 2 and that does indeed start the docker daemon for you. But I don't need all the fancy features it offers so removed it and was pleased to see about 4GB freed and no extra icon in the system tray.
Now if I need to run docker commands I just begin with:
sudo dockerd &
This way I can have it running on the background on the same shell. Note that in this example I have setup sudo without password. If a password is required, I can do sudo dockerd and open another terminal tab.
Although this works as a quick temporary solution I've seen it cause network issues so I would not recommend it, and prefer using a light VM instead.
I've tried soooo many things, and the stuff that worked for me, and no one ever mentioned to try:
(from Windows Powershell)
wsl --set-default <my-distro>
then and there, I could connect to docker without changing the DOCKER_HOST var.
1.open windows docker desktop --> Setting -->General --> Disable Expose daemon on tcp://localhost:2375 without TLS
2.and then Go to Settings --> Resources --> WSL integration --> uncheck Enable integration with my default WSL distro and turn off integration with distro
3.click apply and restart
4.then go to ubuntu
try docker ps
docker ps
if it does not work, continue to run the following command
unset DOCKER_HOST to disable DOCKER_HOST
Today I just tried it successfully
good luck to you
I have found my issue was due to mis-reading instructions., fixed on my windows version 1909 and WSL 2 with the following commands on CMD:
wsl.exe -l -v
wsl.exe --set-version ${distro-name} ${wsl version}
example:
C:\Users\xxxxx>wsl.exe -l -v
NAME STATE VERSION
* Ubuntu-18.04 Running 1
docker-desktop-data Running 2
docker-desktop Running 2
C:\Users\xxxxx>wsl.exe --set-version Ubuntu-18.04 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
That's it
ISSUE: Cannot connect to the Docker daemon at tcp://127.0.0.1:2375
Powershell
wsl -l -v # ALL DISPLAY "2"
Linux
unset DOCKER_HOST
/etc/init.d/docker restart
Restart Docker
windows docker restart
windows firewall off
Linux docker processes
docker ps
I had the same problem, the solution for me was to set my Ubuntu as the default wsl distribution: wsl --set-default Ubuntu
For whatever it's worth (this is an old thread). Maybe someone else is still desperately trying to solve this puzzle.
I have just stumbled over the solution in my case.
I am running the following
docker desktop version 3.3.3
wsl 2
Fedora 33
Over and over again I ran into this issue "Cannot connect to the Docker daemon at unix:///var/run/docker.sock". Reinstalled, restarted, blablabla.
My ultimate error were access rights on /var/run/docker.sock, and I am running wsl under my personal user
srw-rw---- 1 root docker 0 May 7 10:29 /var/run/docker.sock
So if I run as root (sudo docker info) or I put myself into group "docker" (sudo usermod -aG docker $USER) I'm all well. Please look here https://docs.docker.com/engine/install/linux-postinstall/
There is another very basic catch:
Ensure virtualization is enabled in the BIOS.
Please enable the Virtual Machine Platform Windows feature from the selection of additional Windows Features.
Now my motherboard is being very old, the BIOS does not support
Enabling Virtualization.
Hence no solution will work for me.
WSL Version 1 or 2 will come from Windows Update automatically.
After hours, my docker worked using following method.
Go to docker desktop --> Setting -->General --> Disable Expose daemon on tcp://localhost:2375 without TLS
Go to Settings --> Resources --> WSL integration --> uncheck Enable integration with my default WSL distro and turn off integration with distro
Restart Docker desktop
Now in WSL,
unset DOCKER_HOST
Now try,
docker ps
The accepted answer is mostly correct. However, I wanted to specify that when using WSL2 + Docker Desktop:
You must unset DOCKER_HOST which was previously needed in WSL1
Mine was defined in ~/.bashrc in both Windows and WSL.
Delete in both. Also delete in Windows env variables via Control Panel.
Check with env | grep -i docker to make sure it's gone.
You must also set the correct settings in Docker Desktop
Uncheck Export daemon on tcp://localhost:2375 without TLS
Check Use the WSL2 based engine
Resources -> WSL Integration -> Check Enable integration with my default WSL distro
Now, you can do a simple docker info to check if you're running the same server version in WSL and in Windows (Powershell).
you can consider upgrading your version to 19582.1000 , it's work for me.
See this issue.

Sharing docker credentials between Window and WSL

Environment
Windows version and build Version 2004 (OS Build 19037.1)
Docker Edge version 2.1.6.1
Ubuntu 18.04 on WSL 2
Current setup and status:
docker installed on windows
created aliases for docker, docker-compose, docker-credential-desktop, etc ...
Running commands such as docker build, docker ps, docker pull, docker images all work fine. Now I would like push an image and so of course I have to login first.
Problem: logging into docker hub.
I run docker login in the WSL terminal
I put in my username and password
I get the following error
Error saving credentials: error storing credentials - err: exec: "docker-credential-desktop": executable file not found in %PATH
%, out: ``
What I've tried so far
docker login from powershell works fine. So I created a symbolic link between /mnt/c/Users/<winusername>/.docker and /home/<wslusername>/.docker. The equivalent works fine for .aws, but for .docker it was not able to share or even acknowledge the credentials, so it asked again for the user and password and threw the same error as above.
This worked for me,
sudo ln -s /mnt/c/Program\ Files/Docker/Docker/resources/bin/docker-credential-desktop.exe /usr/bin/docker-credential-desktop.exe
Linking the executable from windows path to linux path or you can add the windows PATH on you linux PATH.
Refer: https://github.com/docker/for-win/issues/6652
Update Feb 2021
This is all much simpler now. If you are using WSL2 on a recent release of Windows, just install docker on the Windows side and ensure to configurations:
In General: us the WSL 2 based engine
In Resource/WSL Integration: enable integration with your default WSL distro
You will have to restart docker. Once it is done, everything works transparently.
Below here can be ignored
It turns out that the integration between Docker and WSL is better than I thought. Though it could have been better documented. I was going to change tack and try to install docker in the WSL. So I got rid of all the aliases and restarted my session. Lo and behold, when I ran docker there was still something running.
This is because the edge version of docker create the appropriate symbolic links and now I login into docker hub without any problem.

Docker commands fails (in Windows) [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 months ago.
Improve this question
I am trying to use Docker on a windows machine and is hit with every possible issue it seems. My latest one is this:
My machine is running but I can't seem to interact with it using the docker commands. If I run a very standard command like:
docker ps
I get an error message like this:
An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v
1.23/containers/json: open //./pipe/docker_engine: The system cannot find the file specified.
So apparently some path is all messed up. Do anyone know which path this is and how to fix this?
Edit (2021) - This answer is for the old Docker Toolbox, not Docker Desktop.
When running docker ps and receiving:
An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json: open //./pipe/docker_engine: The system cannot find the file specified.
The following environment properties need to be set:
set DOCKER_CERT_PATH=%USERPROFILE%\.docker\machine\machines\default
set DOCKER_HOST=tcp://192.168.99.100:2376
set DOCKER_MACHINE_NAME=default
set DOCKER_TLS_VERIFY=1
This is assuming the %USERPROFILE%\.docker\machine\machines\default is default path where the cert.pem, key.pem, ca-key.pem, and ca.pem docker files are; the virtual machine name's (created by docker-machine create) is default and Virtual Box DHCP Server's lower bound (found under VirtualBox->File->Preferences->Network->Host-only Networks->hover mouse on VirtualBox Host-Only Ethernet Adapter) is 192.168.99.100 and no other VM is running in VirtualBox.
Same issue here on Win 7. Solution:
In the Docker Quickstart window, at the $ prompt run the below line:
your_user#your_machine MINGW64 ~
$ eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env default)
Then, you'll be able to run "docker run hello-world".
I run into this problem when using docker-machine and I haven't run the docker-machine env command after rebooting. I'm not sure how to do this in cmd.exe, but if you're using powershell try issuing this command:
docker-machine env --shell=powershell | Invoke-Expression
Make sure Hyper-V is up and running:
open elevated command prompt
type bcdedit /set hypervisorlaunchtype auto
reboot
run "Docker for Windows"
I had to deal with the same issue on Windows.
To solve it:
Create a docker machine (only if you have not got one)
docker-machine create default
Get the ENV vars which the docker client needs in order to connect to the docker machine (server) [This you will need to do every time or set in your ENV vars]
docker-machine.exe env default
You can either install them manually or run one of the following depending on your shell environment (cmd, bash, power-shell)
docker-machine env --shell=cmd # you need to run it manually
docker-machine env --shell=bash > env-var-commands-tmp && . env-var-commands-tmp && rm env-var-commands-tmp
docker-machine env --shell=powershell | Invoke-Expression
Open cmd with admin rights.
Execute following command
docker-machine env --shell cmd default
you will receive following output
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.102:2376
SET DOCKER_CERT_PATH=C:\Users\DBashyal.docker\machine\machines\default
SET DOCKER_MACHINE_NAME=default
REM Run this command to configure your shell:
REM #FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd default') DO #%i
Copy the highlighted line and execute on cmd
#FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd default') DO #%i
Execute following command
docker ps
I created a new machine using the below command
docker-machine create --driver=virtualbox vbox-test
Then executed the command
docker-machine env --shell=powershell | Invoke-Expression
Got it Working...
I had a look at all the above answers and none of them worked.
Then I found out that the command has to be run on a linux command line like bash.
so try:
Type the command into the Docker bash terminal VM that comes with the docker toolbox as opposed to the windows cmd
If you have already made sure that your docker has been started
As pointed in other answers you need to set a few environment variables.
The easiest way to do it is:
#FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd') DO #%i
This will run docker-machine env --shell cmd and add those environmental variables.
If you want these variables to be persistent defined them in windows (tutorial).
Right click the Docker icon in the tray a select "Switch to Windows containers...".
You may be prompted to enable the Containers feature. Do so and reboot, again.
To start default host in windows I know three ways given below you can use one of them.
Starting or restarting already created a default machine by the Docker:
docker-machine start default
docker-machine restart default
Now check docker-machine env
The following environment properties need to be set:
set DOCKER_CERT_PATH=%USERPROFILE%\.docker\machine\machines\default
set DOCKER_HOST=tcp://192.168.99.100:2376
set DOCKER_MACHINE_NAME=default
set DOCKER_TLS_VERIFY=1
To create a new machine using the following command:
Windows 10/HyperV:
docker-machine create --driver hyperv default
docker-machine create -d hyperv default
Mac, Linux, windows 7 & 8:
docker-machine create --driver virtualbox default
docker-machine create -d virtualbox default
I had similar issue when I installed Docker CE for Windows Version 17.11.0-ce-rc4-win39 (14244) Channel: edge e557194 on Windows 10.
In Command/cmd windows, when I tried to run commands docker ps, docker version, docker info, the I got error like “error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.34/version” every time.
To resolved this issue,
I made “Hyper-V” off (Unchecked) from “Turn Windows feature on or off”, which required the OS to be restarted.
And after first restart, I made “Hyper-V” On (Checked), which again required the OS to be restarted.
After second restart, above docker commands started working and giving proper output.
So, turning Hyper-V off and then on resolved this issue for me.
I got the solution from this issue. It not just like Nikesh's answer said SwitchDaemon could fix it directly. I think you should run this command twice to switch your daemon to your previous daemon.
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchDaemon
# then check the docker OS/Arch
docker version
# You may see the different OS/Arch
./DockerCli.exe -SwitchDaemon
# then you got your images and containers back
This command is just switch your daemon from your defualt daemon to another daemon(depends on what you set). When you switch to another daemon, the images and containers on the former daemon will disappear(but not deleted).
I have had this issue on a Windows 2016 machine. Happened because the docker service wasn't started. In my case the docker service as failing with the following error
fatal: Error starting daemon: pid file found, ensure docker is not running or delete C:\ProgramData\docker.pid
Deleting the C:\ProgramData\docker.pid file did the trick.
below resolved. i copied answer from another forum
I had this problem after update. After re-installing VB I switched on "VirtualBox NDIS6 Bridged Networking Driver" in properties network connection.
It property switched off default in my case.
Windows 10 Professional
For me the Docker service was running but Docker still needed to be 'started'. That is, I had the setting 'Start Docker when you log in' unchecked in the Docker tray icon.
Prior to finding this out I had gone to the program folder Docker and clicked 'Docker for Windows'. After a short time the message 'Docker is running' was displayed.
For me, this error was resolved after I removed daemon.json file in "%programdata%\docker\config"
The content in my daemon.json is the following:
{
"hosts": ["tcp://0.0.0.0:2375"]
}
I created this manually as part of some testing. But after I restarted the server, I started to get the error in this question.
The error is really troubling. I hope Docker Developers do something about. It took a lot of try and error to get around. Thanks to Stackoverflow and other blogs. In my case, I am using Windows 10 Pro. I settled with DockerToolbox.exe after several failed attempts with Docker for Windows Installer.exe. Then I encountered An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v . The followed these steps and the problem got solved.
First, I went to Control Panel -> Turn Windows Features On or Off and unchecked Hyper-V
Next, Open PowerShell as Admin:
docker-machine env --shell=powershell | Invoke-Expression
type bcdedit /set hypervisorlaunchtype auto
Restarted my System. Then I launched "Docker Quickstart Terminal", then I entered this on the shell window.
run "Docker for Windows"
docker run hello-world
I it went well. Then I open Command Prompt
docker run hello-world
It gave the error: Then I entered
set DOCKER_CERT_PATH=%USERPROFILE%\.docker\machine\machines\default
set DOCKER_HOST=tcp://192.168.99.100:2376
set DOCKER_MACHINE_NAME=default
set DOCKER_TLS_VERIFY=1
Most of the suggestions above too are helpful.
I saw this error message after a weekend. My setup was fine before that. My config and connections looked correct. $docker-machine restart default fixed it for me on Windows 7
I was getting this error, while running the command docker-compose up. The problem for me was, the docker service was not running. So I had to run services.msc and start the docker service.
I solved this error by run the {DOCKER_TOOLBOX_INSTALL_PATH}start.sh in bash.
In my case, all above solutions did not resolve. Instead zilurrane response helped.
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchDaemon
Switch to Windows Containers
docker info
docker ps
Switch back to Linux containers
docker info
Viola!
The windows switch likely runs the missing configurations that Linux also needs.
I was having similar issue. For me I hadn't logged in to docker from the status bar. What I did was to login to docker from status bar. Once I logged in I was able to run all the commands properly.
Try logging in using your docker id and password maybe that will resolve your issue.
I had the same issue on my Windows 10. Find below what I did to solve it:
After installing Docker, Just restart your PC, run docker application (It may require enabling Hyper-V), then open command line and type:
docker run hello-world
Everything works fine :)
I had this problem. I searched a lot. I checked many things. But in the end, the solution that solved my problem was the following solution.
System Environment:
Windows 10 Professional
Windows engine in Docker
Docker version 20.10.21
Solution
disabled IP6
And
Restarted the service and application

Resources