Bug: Docker build hangs

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.

Thank you for responding so fast.

docker context ls gives the following output:

NAME                TYPE                DESCRIPTION                               DOCKER ENDPOINT                             KUBERNETES ENDPOINT   ORCHESTRATOR
default *           moby                Current DOCKER_HOST based configuration   npipe:////./pipe/docker_engine
desktop-linux       moby                Docker Desktop                            npipe:////./pipe/dockerDesktopLinuxEngine

Is that what’s expected there?

About this ‘switch from or to Linux containers’. Do you mean that option “Use the WSL 2 based engine”? This is enabled.

However, this “Docker Desktop” seems to work as it used to for many months. It’s just that docker build suddenly seems to have stopped working.

Thank you for pointing me to this Github repository. I’ll file a bug report there in a few hours.

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.

Client:
 Cloud integration: v1.0.35-desktop+001     
 Version:           24.0.5
 API version:       1.43
 Go version:        go1.20.6
 Git commit:        ced0996
 Built:             Fri Jul 21 20:36:24 2023
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Desktop 4.22.1 (118664)
 Engine:
  Version:          24.0.5
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.6
  Git commit:       a61e2b4
  Built:            Fri Jul 21 20:35:45 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

I have the same problem. Previously working docker builds now just start and hang.

Client:
 Cloud integration: v1.0.35-desktop+001
 Version:           24.0.5
 API version:       1.43
 Go version:        go1.20.6
 Git commit:        ced0996
 Built:             Fri Jul 21 20:36:24 2023
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Desktop 4.22.1 (118664)
 Engine:
  Version:          24.0.5
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.6
  Git commit:       a61e2b4
  Built:            Fri Jul 21 20:35:45 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0```