docker / for-mac

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

Docker resumes itself automatically after pause #6908

Open uphlewis opened 1 year ago

uphlewis commented 1 year ago

Description

Several times now i've noticed that docker is running, despite having previously paused it. It appears that some time after pausing docker (approx 5 minutes or so?), it inexplicably resumes itself and is running again.

Reproduce

In the menu bar, click on the Docker Desktop icon, then click Pause. After some time, clicking back on this icon it appears that at some point docker is running again, so has resumed by itself.

Expected behavior

After pause, docker should remain paused until the user explicitly opts to resume.

docker version

Client:
 Cloud integration: v1.0.35
 Version:           24.0.2
 API version:       1.43
 Go version:        go1.20.4
 Git commit:        cb74dfc
 Built:             Thu May 25 21:51:16 2023
 OS/Arch:           darwin/amd64
 Context:           desktop-linux

Server: Docker Desktop 4.21.1 (114176)
 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:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.0
    Path:     /Users/harry/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.19.1
    Path:     /Users/harry/.docker/cli-plugins/docker-compose
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/harry/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.20
    Path:     /Users/harry/.docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.6
    Path:     /Users/harry/.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/harry/.docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     /Users/harry/.docker/cli-plugins/docker-scan
  scout: Command line tool for Docker Scout (Docker Inc.)
    Version:  0.16.1
    Path:     /Users/harry/.docker/cli-plugins/docker-scout

Server:
 Containers: 5
  Running: 5
  Paused: 0
  Stopped: 0
 Images: 47
 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: 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: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: v1.1.7-0-g860f061
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.49-linuxkit-pr
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 6
 Total Memory: 3.841GiB
 Name: docker-desktop
 ID: 8fbffe31-7bac-4a1a-afca-609d6a9c7656
 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

Diagnostics ID

9A4D113C-F0C8-4CC0-8D39-70FD8C991DF4/20230710092805

Additional Info

No response

sonbui00 commented 1 year ago

I see the same issue

sebschlo commented 1 year ago

Same here

jovolopez commented 1 year ago

Same issue here, in version 4.22.0 (117440) of Docker Desktop.

uphlewis commented 1 year ago

@sonbui00 @sebschlo @jvipez

It might be helpful for you to also generate a diagnostics ID for the devs to see how our setups intersect ?

https://docs.docker.com/desktop/troubleshoot/overview/#diagnose

sonbui00 commented 1 year ago

@uphlewis C66ED105-8E20-44CC-A06D-8DFD6256C35A/20230822041856

sebschlo commented 1 year ago

@uphlewis 0DFD0413-58B0-4097-A9C1-461BC37DDE0F/20230822164831

jovolopez commented 1 year ago

@uphlewis D9D1B853-7EF6-40A3-BF0C-42486C35AA8A/20230822230010

thedmdim commented 1 year ago

Same, 4.22.1 on mac

juan-yunis commented 1 year ago

Same here, 4.22.1, macOs Ventura 13.6

bsousaa commented 1 year ago

Upgrade to 4.23 or 4.24.

rhysb27 commented 1 year ago

Same here on 4.24.0 on MacOs Monterey (Diagnostics ID: 82CFEBE5-ED2F-4CA3-B3CF-E41678370A02/20231005105346)

In my case I had already paused a Docker Compose stack. Attempting to resume it after noticing Docker had unpaused led to Error response from daemon: Cannot unpause container: OCI runtime resume failed: container not paused: unknown and a dangling image.

bsousaa commented 1 year ago

@rhysb27 - trying to understand your use case for pause/unpause - why exactly are you pausing the engine? In the case of resources optimization does the Resource Saver (which automatically does the job) work for you? Or are there any other use cases?

uphlewis commented 1 year ago

Just had this again on 4.24.0 (122432)

I paused docker, plugged in my laptop, checked power consumption / charging time estimation and it still listed docker as consuming a lot of power so i checked again and it was unpaused!

anodynos commented 1 year ago

Mine resumes almost immediately, in 5 secs or so. I tried many times, with UI open & not, same behavior.

On latest Docker Desktop 4.24.2 on latest Windows 10 (as of 2023-10-23)

tibuprophen commented 1 year ago

Same here, 4.24.2 Mac Os 13.6 (22G120) Docker pauses and resumes in under 5 seconds.

ginteraminense commented 1 year ago

Same here too, Docker v4.25.0 on W Version 10.0.22621 Build 22621.

Engine restarts itself 2~5 seconds after pause command is given.

karman-docker commented 1 year ago

@rhysb27 in your diag I saw that you are running docker events command. That will wakeup Docker from pause state. Can you try after terminating docker events command and see pause state is retained ?

If it was not you who started docker events command, can you kindly check the parent process of that command and let us know which process started it ?

thkerkmann-rwe commented 1 year ago

Could it be that intelliJ or VSCode with Docker plugin will trigger the resume?

sbalashevich commented 12 months ago

It looks like the Docker gets unpaused any time when the "docker" command is used, doesn't matter if it is CLI , k3d or IntelliJ Docker plugin is connected. For me, the Docker can be in a paused state for quite a long period of time, but if the Idea is connected to it, Docker resumes in seconds after the pause button is pressed

image
karunpoudel-chr commented 8 months ago

my laptop's battery dies quickly if docker is enabled unintentionally 😀, at least it should give desktop notification so that i can pause it or fetch power cord. when something is trying to access docker, i want it to say docker is not running rather than unpause automatically. docker_unpause

Spiral90210 commented 8 months ago

This happens to me as well, gets unpaused after about 5s. Enabling debug logging shows the following:

log enabled with these settings:

{
"debug":true,
"log-level": "debug"
}
[2024-02-23T19:08:08.052146130Z][dockerd][I] time="2024-02-23T19:08:08.050975755Z" level=debug msg="Calling HEAD /_ping"
[2024-02-23T19:08:08.052151588Z][dockerd][I] time="2024-02-23T19:08:08.051076255Z" level=debug msg="Calling HEAD /_ping"
[2024-02-23T19:08:08.057347755Z][dockerd][I] time="2024-02-23T19:08:08.057276421Z" level=debug msg="Calling GET /v1.44/version"
[2024-02-23T19:08:08.057513463Z][dockerd][I] time="2024-02-23T19:08:08.057417088Z" level=debug msg="Calling GET /v1.44/version"
[2024-02-23T19:08:08.061171505Z][dockerd][I] time="2024-02-23T19:08:08.061109713Z" level=debug msg="Calling GET /v1.44/events?filters=%7B%22type%22%3A%7B%22container%22%3Atrue%7D%7D"
[2024-02-23T19:08:08.061200421Z][dockerd][I] time="2024-02-23T19:08:08.061116255Z" level=debug msg="Calling GET /v1.44/events?filters=%7B%22type%22%3A%7B%22container%22%3Atrue%7D%7D"
[2024-02-23T19:08:08.061887171Z][dockerd][I] time="2024-02-23T19:08:08.061831213Z" level=debug msg="Calling GET /v1.44/containers/json?all=1"
[2024-02-23T19:08:08.062861588Z][dockerd][I] time="2024-02-23T19:08:08.061832921Z" level=debug msg="Calling GET /v1.44/containers/json?all=1"
[2024-02-23T19:08:08.070751296Z][dockerd][I] time="2024-02-23T19:08:08.070596380Z" level=debug msg="Calling GET /v1.44/containers/6f4c4e728271/stats?stream=0"
[2024-02-23T19:08:08.070755796Z][dockerd][I] time="2024-02-23T19:08:08.070645005Z" level=debug msg="Calling GET /v1.44/containers/a831d87768d9/stats?stream=0"
[2024-02-23T19:08:08.070756130Z][dockerd][I] time="2024-02-23T19:08:08.070666338Z" level=debug msg="Calling GET /v1.44/containers/6f4c4e728271/stats?stream=0"
[2024-02-23T19:08:08.070757338Z][dockerd][I] time="2024-02-23T19:08:08.070678338Z" level=debug msg="Calling GET /v1.44/containers/082cc58691be/stats?stream=0"
[2024-02-23T19:08:08.070757588Z][dockerd][I] time="2024-02-23T19:08:08.070600671Z" level=debug msg="Calling GET /v1.44/containers/f066f053e584/stats?stream=0"

[...] one per container

[2024-02-23T19:08:09.589168172Z][dockerd][I] time="2024-02-23T19:08:09.588888922Z" level=debug msg="Client context cancelled, stop sending events"
[2024-02-23T19:08:09.590033380Z][dockerd][I] time="2024-02-23T19:08:09.588950505Z" level=debug msg="Client context cancelled, stop sending events"

It's clear something is calling into the daemon and it's appx every 10s, anyone got any advice as to how to trace what? This happens pretty continually - I don't have any IDE open at the time. What I do have is crowdstrike/falcon going on which would be suspect, but I've been told that there's nothing set up to monitor docker. I won't believe it without proof of what is actually submitting these commands though.

It might be good to know if everyone else having these problems also sees these kind of logs every 10 or so seconds. I cannot think what needs to ping docker every 10 flipping seconds!

UriZafrir commented 7 months ago

same here. how can i trace what calls the daemon?

[2024-03-19T06:07:02.003660213Z][dockerd][I] time="2024-03-19T06:07:02.003424338Z" level=debug msg="Calling GET /v1.44/images/json?filters=%7B%22reference%22%3A%7B%22eclipse-temurin%22%3Atrue%7D%7D" [2024-03-19T06:07:02.009916588Z][dockerd][I] time="2024-03-19T06:07:02.009833671Z" level=debug msg="Calling HEAD /_ping" [2024-03-19T06:07:02.011109838Z][dockerd][I] time="2024-03-19T06:07:02.011012546Z" level=debug msg="Calling GET /v1.44/images/json?filters=%7B%22reference%22%3A%7B%22tomcat%22%3Atrue%7D%7D" [2024-03-19T06:07:02.013603713Z][dockerd][I] time="2024-03-19T06:07:02.013543005Z" level=debug msg="Calling HEAD /_ping" [2024-03-19T06:07:02.014141546Z][dockerd][I] time="2024-03-19T06:07:02.014068088Z" level=debug msg="Calling GET /v1.44/images/json?filters=%7B%22reference%22%3A%7B%22gradle%22%3Atrue%7D%7D" [2024-03-19T06:07:02.015923463Z][dockerd][I] time="2024-03-19T06:07:02.015867338Z" level=debug msg="Calling HEAD /_ping" [2024-03-19T06:07:02.016779338Z][dockerd][I] time="2024-03-19T06:07:02.016731088Z" level=debug msg="Calling GET /v1.44/images/json?filters=%7B%22reference%22%3A%7B%22maven%22%3Atrue%7D%7D" [2024-03-19T06:07:02.018620463Z][dockerd][I] time="2024-03-19T06:07:02.018565046Z" level=debug msg="Calling HEAD /_ping" [2024-03-19T06:07:02.019354296Z][dockerd][I] time="2024-03-19T06:07:02.019309046Z" level=debug msg="Calling GET /v1.44/images/json?filters=%7B%22reference%22%3A%7B%22postgres%22%3Atrue%7D%7D" [2024-03-19T06:07:02.021619255Z][dockerd][I] time="2024-03-19T06:07:02.021542921Z" level=debug msg="Calling HEAD /_ping" [2024-03-19T06:07:02.022291880Z][dockerd][I] time="2024-03-19T06:07:02.022241546Z" level=debug msg="Calling GET /v1.44/images/json?filters=%7B%22reference%22%3A%7B%22nginx%22%3Atrue%7D%7D"

Spiral90210 commented 7 months ago

Yours looks a little different to mine @UriZafrir, you have filters like:

GET /v1.44/images/json?filters={"reference":{"eclipse-temurin":true}}
GET /v1.44/images/json?filters={"reference":{"tomcat":true}}
GET /v1.44/images/json?filters={"reference":{"gradle":true}}
GET /v1.44/images/json?filters={"reference":{"maven":true}}
GET /v1.44/images/json?filters={"reference":{"postgres":true}}
GET /v1.44/images/json?filters={"reference":{"nginx":true}}

So, something looking for very specific things - at a guess, you have an IDE plugin (are you using eclipse) or some other system that is looking for things it knows how to handle. What applications are running at the same time as these logs?

Spiral90210 commented 7 months ago

I've done a little bit of process watching. With the Activity Monitor update frequency increased to 1s, I can see a process com.docker.cli appearing after pausing docker. The parent process? Docker Desktop.

Docker desktop (the app) was not open on my screen. With it open, I can see "docker is paused" on the main screen, but then it springs to life when something else pings the api.

Given my call profile of a ping, listing all type=container, then calling stats for each one, I believe something inside docker desktop is not respecting it being paused, and polling for stats. I assumed the 'Resource Usage' extension (docker 1st party extension), but updating/removing that did not seem to have an effect.

But.

I've since restarted docker desktop without the extension, and it looks like that might have actually had an effect. I'm going to monitor over the next couple of days, but this may boil down to docker extensions needing to be forcefully stopped when docker desktop is paused, or at least be prevented from calling the cli. At least, it's an update to Resource Usage.

EDIT: I also seemed unable to adjust the resource usage poll frequency - it would let me select 5m in the dropdown, but never applied it - when I navigated away and back it had just reset to 5s.

Spiral90210 commented 7 months ago

So, anyone else with this problem (docker desktop being unapused every 5-10s) I would suggest trying:

If that works for you, give this a 👍 so we can see if that's widespread, or just me.

UriZafrir commented 7 months ago

Hi Spiral, that might be a good guess. I though it solved the problem but I'm not sure because after 10 minutes it resumed again after opening vscode. I'm using VScode. I also have a kind cluster installed with crossplane on it using docker. I've closed VScode and it seems docker engine never resumes! After opening VScode docker resumed. I thought my kubernetes extension polls docker so I've disabled it and suddenly for 10 minutes the docker didn't resume. I will try to find more details. other extensions installed are python, yaml and git graph. it used to resume faster, so I guess there might be another thing querying docker.

I still don't understand what to do with these logs to understand what is causing this behavior. it seems the logs got shorter, this is the loop (dropped all non necessary text):

"Calling HEAD /_ping" "Calling HEAD /_ping" "Calling GET /v1.44/version" "Calling GET /v1.44/version" "Calling GET /v1.44/events?filters={"type":{"container":true}}" "Calling GET /v1.44/events?filters={"type":{"container":true}}" "Calling GET /v1.44/containers/json?all=1" "Calling GET /v1.44/containers/json?all=1" "Calling GET /v1.44/containers/00330a101eb6/stats?stream=0" "Calling GET /v1.44/containers/00330a101eb6/stats?stream=0"

burfot commented 7 months ago

Same issue

Spiral90210 commented 7 months ago

@UriZafrir your logs now look exactly like mine did! Can you try what I suggested and remove all docker desktop extensions and restart docker completely. I think there's a zombie process for at least resource usage that persists when the extension is removed, and the system needs a restart to be able to purge it.

@burfot same suggestion - quit all your IDE's and apps other than docker, see if it persists, then remove all your extensions, restart and try again.

burfot commented 7 months ago

I have no extensions installed. I have restarted the PC a couple times.

Kind regards, Paul

On 2024-03-25, at 23:54, David Bennington @.***> wrote:



@UriZafrirhttps://github.com/UriZafrir your logs now look exactly like mine did! Can you try what I suggested and remove all docker desktop extensions and restart docker completely. I think there's a zombie process for at least resource usage that persists when the extension is removed, and the system needs a restart to be able to purge it.

@burfothttps://github.com/burfot same suggestion - quit all your IDE's and apps other than docker, see if it persists, then remove all your extensions, restart and try again.

— Reply to this email directly, view it on GitHubhttps://github.com/docker/for-mac/issues/6908#issuecomment-2017723682, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALRNCC4KGN6AXP7SPAQQUULYZ767DAVCNFSM6AAAAAA2EIKUAGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJXG4ZDGNRYGI. You are receiving this because you were mentioned.Message ID: @.***>

UriZafrir commented 7 months ago

I also had no extensions. I gave up, went for rancher desktop or colima with docker.