Docker build command hangs indefinitively. I managed to break this down to the following minimal example to reproduce it:
create an empty directory somewher on your harddisk
in this directory create a “Dockerfile” with the following two lines as content:
FROM busybox:latest
CMD ["date"]
then on the command line in this directory execute the following command:
docker build -t foobar .
If I do that as a test on a Linux Server VM docker starts to build the image and I see some lines of output. After a few seconds everything finishes successfully as expected.
However, if I try the same on my Windows 10 developer machine, I get nothing. The command just hangs forever without any output. Nothing happens. I see processes in the system and kill them after some time as they hang forever.
It was yesterday when I encountered this problem the first time. I updated Windows, updated docker via Docker for Windows and rebootet the system. Then docker build did run successfully (= it did not hang).
Today I have the same problem again. This time I could not update anything as there simply is nothing more to update. But I rebootet the system (twice). However, the problem persists: I do not get any output of the command, the command just hangs forever.
Does anybody else encounter this bug as well?
Has anyone an idea how to fix this? Can Docker Inc. fix this? This seems to be a bug.
This is a showstopper right now as I can no longer build any docker images at all. Any help is apprechiated!
I guess when you previously updated Windows and Docker something restarted and it was not the update itself that helped. Docker commands have to access the Docker api which is probably not responding or something changed the context (docker context ls). You should also make sure your Docker Desktop. is switched to Linux containers even if you are sure that you didn’t change it intentionally.
And yes, you can search among issues on GitHub and report the issue if you think it is a new bug.
No. I meant that Docker Desktop supports running Windows containers and Linux containers. Ther is a switch in the menu when you click on the whale icon in the notification area: “Switche to Linux containers” or “Switch to Windows containers”.
Your Linux containers could still run if you switched to Windows containers, but you can’t build or run another Linux container using the docker command, because that uses the endpoint of the Windows container mode.
It seems you don’t have Windows container context which is called “docker-windows” on my machine, which indicates switching between these two modes couldn’t be the problem.
Ah, I didn’t even realize there was an icon there, since that icon is hidden.
There’s an option such as “Switch to Windows containers”. I assume that means that containers are stored on “Linux”. To my knowledge that’s the default. But I guess this would affect the whole container management process. (This works fine. Sometimes it seems that only building containers fails.)
I also use Windows 10 and WSL2 longtime ago, use Linux containers for many years, I got no issue with docker build, both on Windows directly or inside WSL2. Few days ago, I just realized that I cannot build on Windows now, only can build on WSL2. Everything still correct, docker context default also correct.
I guess Windows update recently or Docker update recently cause this bug, and dont know where to read the logs or find the issue.
I just updated to the latest version of docker using the docker desktop update button. I am also no longer able to run docker build. The command line will hang indefinitely until I press Ctrl + C thrice which aborts the build. No output is written.