docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.86k stars 290 forks source link

docker build hangs #13570

Open mmj579 opened 1 year ago

mmj579 commented 1 year ago

Description

For unknown reasons docker build has stop to work on my Windows 10 development machine. It works fine on other machines.

Reproduce

  1. create an empty directory somewhere on your harddisk
  2. in this directory create a “Dockerfile” with the following two lines as content:
    • FROM busybox:latest
    • CMD ["date"]
  3. on the command line in this directory execute the following command:
    • docker build -t foobar .

Result: Nothing. No output. The command hangs. Nothing happens at all (probably infinitely - I typically kill the process after 20 minutes or so).

Example:

D:\Temp4\tmp6ytgibhl\y>docker builder build -t foobar .
_

(The underscore represents the blinking cursor.)

Expected behavior

Messages about the build process and it's completion. Or at least one or more error messages.

NOTE: This works fine on Linux VMs I used as a reference to compare this behavior with.

docker version

Client:
 Cloud integration: v1.0.33
 Version:           24.0.2
 API version:       1.43
 Go version:        go1.20.4
 Git commit:        cb74dfc
 Built:             Thu May 25 21:53:15 2023
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Desktop 4.20.1 (110738)
 Engine:
  Version:          24.0.2
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.4
  Git commit:       659604f
  Built:            Thu May 25 21:52:17 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

docker info

Client:
 Version:    24.0.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.5
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.18.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.19
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.4
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scan.exe
  scout: Command line tool for Docker Scout (Docker Inc.)
    Version:  v0.12.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 17
 Server Version: 24.0.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: active
  NodeID: 0455q3k7kb45smgan5xeyi8s8
  Is Manager: true
  ClusterID: ov9e4xtgj9efqg2kl5g5tig3n
  Managers: 1
  Nodes: 1
  Default Address Pool: 10.0.0.0/8
  SubnetSize: 24
  Data Path Port: 4789
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: 192.168.65.4
  Manager Addresses:
   192.168.65.4:2377
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: v1.1.7-0-g860f061
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
 Kernel Version: 5.10.102.1-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 24.84GiB
 Name: docker-desktop
 ID: 57d28c2d-e22c-4305-862d-53dafef5ee38
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support

Diagnostics ID

21483797-3CAD-4BD9-8275-0CE2B201645A/20230629081847

Additional Info

I run into the problem three days ago. Then I updated Windows and updated Docker for Windows, restarted my machine. Then everything worked fine. Until the next day: Same situation. docker build hang again. This time there's nothing to update. And reboots did not change the situation.

samuk190 commented 1 year ago

it must be the memory leak issue that has been reported over several years and has been fixed in the latest experimental batch of WSL.

Problem: build hangs Reason: Memory usage too high, it crashes the docker engine. Why memory usage high ? Due to WSL not reclaiming ram from docker, and docker not reclaiming its own cache ram Solution: Download the experimental wsl build 1.37 and put this on your .wslconfig

[experimental] autoMemoryReclaim=true

If you want even less memory usage, install docker directly inside WSL as WSL now uses systemd.

There is only issue I've found so far but it doesnt bother me. The auto reclaim feature takes some time to work.

mgodinez1972 commented 1 year ago

I am having this same exact problem. What is the current status of this ticket? Any updates since June 2023? Below is the docker log file. I am using the latest version 4.24.2. I am using Windows containers.

log.txt