Kay
Kay

Reputation: 19640

MAC - Docker commands hanging

all of my docker commands are hanging, for example when i run

docker image ls

Docker version : 17.12.0 Mac Version: 10.13.3

Upvotes: 5

Views: 11085

Answers (3)

riddle_me_this
riddle_me_this

Reputation: 9125

The only way I was able to solve this was to choose "Reset to factory defaults" from the Troubleshoot menu (or the bug icon if you have that).

I previously tried reinstalling, increasing the CPU and swap allocation, clean/purge, and moving the files in .docker. I was hoping for a less invasive option.

Upvotes: 0

SriniMe
SriniMe

Reputation: 21

I had a similar situation.

I am using Docker Desktop 18.x.

  1. Try disabling Kubernetes (PreferencesKubernetes menu option) and see if the response arrives quickly. Docker will try to update Kubernetes and this can take some time.
  2. Maybe you already have Docker installed through Homebrew. This command may help: brew uninstall --force docker.

Upvotes: 2

gravetii
gravetii

Reputation: 9624

This is a known issue for Docker on Mac. I faced the same issue when I tried to dig a little deeper into this problem, and found a solution that worked for me.

By default, Docker allocates 4 CPU cores to the docker daemon. When your docker hangs, if you check the CPU utilization on your machine via the Activity Monitor, you will probably see that the process takes 400% of the CPU - which means that it's maxing out on CPU and thus becomes unresponsive.

While the eventual fix would have to be provided by the Docker team, what you can do is allocate more cores to your Docker process so that it doesn't keep hanging. You can do that by clicking on the Docker icon at the top right on your Mac. Then navigate to Preferences -> Advanced. There, you can increase the number of CPU cores you want to allocate to Docker. Changing it from 4 to 6 did the trick for me. You can even try to increase the max-memory you want to allocate to the process, though I don't suspect memory is the issue.

Hope this helps.

Upvotes: 10

Related Questions