Open4

macOS で Docker 環境構築

nukopynukopy

Homebrew Cask でインストールした Docker 環境が壊れたので、公式のインストーラから環境構築し直す。

環境

  • ハードウェア
$ system_profiler SPHardwareDataType
Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro18,4
      Model Number: Z15H000XLJ/A
      Chip: Apple M1 Max
      Total Number of Cores: 10 (8 performance and 2 efficiency)
      Memory: 64 GB
      System Firmware Version: 10151.40.171.501.2
      OS Loader Version: 10151.40.171.501.2
      Serial Number (system): ****
      Hardware UUID: ****
      Provisioning UDID: ****
      Activation Lock Status: Enabled
  • OS
$ sw_vers
ProductName:            macOS
ProductVersion:         14.1
BuildVersion:           23B5056e

手順

https://docs.docker.com/desktop/install/mac-install/
https://docs.docker.com/desktop/mac/permission-requirements/#installing-symlinks

  1. Docker.dmg インストール
  2. /Applications/Docker.app をダブルクリックで起動(初回 Docker Engine 起動に 5 分くらいかかった)
  3. Docker CLI に PATH を通す:.zshrc に 以下のコマンドを追加
    export PATH="$HOME/.docker/bin:$PATH"
    
  4. CLI のバージョンが確認できたら OK
    docker --version
    # Docker version 24.0.6, build ed223bc
    
nukopynukopy

docker ps が反応しない

トラブルシュート

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

self diagnose tool を実行

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

 /Applications/Docker.app/Contents/MacOS/com.docker.diagnose check

診断結果

Starting diagnostics

[PASS] DD0027: is there available disk space on the host?
[PASS] DD0028: is there available VM disk space?
[PASS] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[PASS] DD0017: can a VM be started?
[PASS] DD0016: is the LinuxKit VM running?
[FAIL] DD0011: are the LinuxKit services running? failed to ping VM diagnosticsd with error: Get "http://ipc/ping": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
[2023-10-22T14:42:13.617415000Z][com.docker.diagnose.ipc][I] ipc.NewClient: 9aa02c5f-diagnose -> <HOME>/Library/Containers/com.docker.docker/Data/diagnosticd.sock diagnosticsd
[2023-10-22T14:42:13.617467000Z][com.docker.diagnose.ipc][I] (f199d64d) 9aa02c5f-diagnose C->S diagnosticsd GET /ping
[2023-10-22T14:42:14.619493000Z][com.docker.diagnose.ipc][W] (f199d64d) 9aa02c5f-diagnose C<-S NoResponse GET /ping (1.001951208s): Get "http://ipc/ping": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

[FAIL] DD0004: is the Docker engine running? prereq failed: are the LinuxKit services running?
[PASS] DD0015: are the binary symlinks installed?
[FAIL] DD0031: does the Docker API work? prereq failed: is the Docker engine running?
[PASS] DD0013: is the $PATH ok?
[FAIL] DD0003: is the Docker CLI working? prereq failed: is the Docker engine running?
[FAIL] DD0038: is the connection to Docker working? prereq failed: is the Docker engine running?
[PASS] DD0014: are the backend processes running?
[PASS] DD0007: is the backend responding?
[PASS] DD0008: is the native API responding?
[SKIP] DD0009: is the vpnkit API responding?
[PASS] DD0010: is the Docker API proxy responding?
[FAIL] DD0030: is the image access management authorized? prereq failed: is the Docker engine running?
[PASS] DD0033: does the host have Internet access?
[PASS] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[PASS] DD0017: can a VM be started?
[PASS] DD0016: is the LinuxKit VM running?
[WARN] DD0011: are the LinuxKit services running? failed to ping VM diagnosticsd with error: Get "http://ipc/ping": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
[WARN] DD0004: is the Docker engine running? prereq failed: are the LinuxKit services running?
[PASS] DD0015: are the binary symlinks installed?
[WARN] DD0031: does the Docker API work? prereq failed: is the Docker engine running?
[WARN] DD0032: do Docker networks overlap with host IPs? prereq failed: does the Docker API work?

Please note the following 4 warnings:

1 : The check: are the LinuxKit services running?
    Produced the following warning: failed to ping VM diagnosticsd with error: Get "http://ipc/ping": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

The Docker engine runs inside a Linux VM as a service. Therefore the services must have started.

2 : The check: is the Docker engine running?
    Produced the following warning: prereq failed: are the LinuxKit services running?

The Docker engine manages all containers and images on the host. Check the dockerd.log to see why it failed to start.

3 : The check: does the Docker API work?
    Produced the following warning: prereq failed: is the Docker engine running?

If the Docker API is not available from the host then Docker Desktop will not work correctly.

4 : The check: do Docker networks overlap with host IPs?
    Produced the following warning: prereq failed: does the Docker API work?

If the subnet used by a Docker network overlaps with an IP used by the host, then containers
won't be able to contact the overlapping IP addresses.

Try configuring the IP address range used by networks: in your docker-compose.yml.
See https://docs.docker.com/compose/compose-file/compose-file-v2/#ipv4_address-ipv6_address


Please investigate the following 1 issue:

1 : The test: are the LinuxKit services running?
    Failed with: failed to ping VM diagnosticsd with error: Get "http://ipc/ping": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

The Docker engine runs inside a Linux VM as a service. Therefore the services must have started.