1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Mac + Lima + Docker の registry-mirrors 設定手順

1
Posted at

対象環境

  • macOS 上の Lima(インスタンス名: docker)
  • Docker は rootless mode(systemd --user 管理)
  • 使用する設定ファイルは ~/.config/docker/daemon.json

手順 1:Lima VM にログイン

limactl shell docker

手順 2:Docker の設定ディレクトリを作成

mkdir -p ~/.config/docker

手順 3:daemon.json を作成・編集

vi ~/.config/docker/daemon.json

内容例:

{
  "registry-mirrors": ["https://mirror.gcr.io"]
}

mirror.gcr.io は Google Artifact Registry(Google Cloud)が運用する、
Docker Hub の一部 public イメージをキャッシュしたミラー。
完全な Docker Hub 互換ではなく、頻繁に利用されるイメージのみキャッシュされている。

関連ドキュメント:
https://docs.cloud.google.com/artifact-registry/docs/pull-cached-dockerhub-images


手順 4:rootless Docker を再起動

systemctl --user restart docker

状態確認:

systemctl --user status docker

Active: active (running) が表示されれば再起動成功。


手順 5:設定の反映確認

確認方法:

docker info --format '{{ json .RegistryConfig.Mirrors }}'

期待される出力例:

["https://mirror.gcr.io"]

補足情報

rootless Docker の設定ファイル場所

~/.config/docker/daemon.json

rootless Docker は /etc/docker/daemon.json を読み込まない。

再起動に失敗した場合

systemd --user が使えない構成では、Lima VM を再起動する。

exit
limactl stop docker
limactl start docker
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?