docker / for-mac

Bug reports for Docker Desktop for Mac
https://www.docker.com/products/docker#/mac
2.44k stars 118 forks source link

CPU Usage peaks to 800% on running amd64 docker images #7145

Open AryanNanda17 opened 9 months ago

AryanNanda17 commented 9 months ago

Description

I am trying to run an amd64 docker image on my Mac m1 using rosetta emulation. But on running the image the CPU usage becomes very high and the Disk read/write also. Due to this, the webpage becomes very laggy. Please help me in figuring out what to do.

Screenshot 2024-01-27 at 11 15 49 PM

Reproduce

Expected behavior

No response

docker version

Version : 24.0.7

docker info

─ docker info                                                                                                                 ─╯
Client:
 Version:    24.0.7
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.12.0-desktop.2
    Path:     /Users/Aryan/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.23.3-desktop.2
    Path:     /Users/Aryan/.docker/cli-plugins/docker-compose
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/Aryan/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.21
    Path:     /Users/Aryan/.docker/cli-plugins/docker-extension
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  0.1
    Path:     /Users/Aryan/.docker/cli-plugins/docker-feedback
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.10
    Path:     /Users/Aryan/.docker/cli-plugins/docker-init
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /Users/Aryan/.docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     /Users/Aryan/.docker/cli-plugins/docker-scan
  scout: Docker Scout (Docker Inc.)
    Version:  v1.2.0
    Path:     /Users/Aryan/.docker/cli-plugins/docker-scout

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 3
 Server Version: 24.0.7
 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: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f
 runc version: v1.1.10-0-g18a0cb0
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
  cgroupns
 Kernel Version: 6.5.11-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 8
 Total Memory: 7.76GiB
 Name: docker-desktop
 ID: 5eddb329-86b8-4567-bc7f-d99707e63b29
 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: daemon is not using the default seccomp profile

Diagnostics ID

385cd9da-7c16-4874-b37a-1f72d353808e/20240127175757

Additional Info

No response

dgageot commented 9 months ago

Hi @AryanNanda17, sorry to hear about this issue. Which version of Docker Desktop are you using? Which version of macOS?

AryanNanda17 commented 9 months ago

Hii @dgageot M1 Mac Version - 14.0 and Docker version 24.0.7

dgageot commented 9 months ago

Mac OS 14.0 had some ugly Rosetta bugs. Could you try to upgrade to 14.2? Also, you shared the version of Docker but could you give us the version of Docker Desktop? You should see in on the About dialog:

Screenshot 2024-01-29 at 19 17 46
AryanNanda17 commented 9 months ago
Screenshot 2024-01-30 at 1 35 10 AM
AryanNanda17 commented 9 months ago

I updated to 14.3 but the issue persists. Could you please try to reproduce the issue on your end:-

dgageot commented 9 months ago

Sure, let me give it a try!

dgageot commented 9 months ago

@AryanNanda17 I'm able to reproduce on 4.26.1 but It doesn't happen until I open one of the exercises. I'll try on 4.27

dgageot commented 9 months ago

@AryanNanda17 It does also reproduce on 4.27. It mostly comes from the gzServer process which runs Gazebo as an emulated process. I tried to run it with Qemu instead of Rosetta but it's even worth, it'll just panic. I'm afraid there's not much we can do in Docker Desktop for now.

One thing you can do is give the container only a portion of your CPU cores so that it doesn't use them all. This can be done by adding --cpus X to your command. e.g --cpus 3. Hope this helps a bit.

AryanNanda17 commented 9 months ago

It doesn't help much but thanks for looking into this issue.

paulZuk commented 9 months ago

I've got similar issue and maybe related to this. M3 Pro, Sonoma 14.3, amd64 docker image, rosetta emulation - Docker Desktop(4.27.1). After update to .NET Core 8.0 all containers constantly 100% cpu usage.

image