Docker Desktop から Colima へ移行 - #94
Open
9sako6 wants to merge 3 commits into
Open
Conversation
Docker Desktopに代わりcolima経由でDockerを利用できるよう nix-darwinのsystemPackagesにcolima/docker/docker-buildx/docker-composeを追加する。 Co-Authored-By: muse-spark-agent (muse-spark-1.2-contributor) <muse-spark-agent@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目的
macOS の Docker 実行環境を Docker Desktop から Colima へ移行する。
Docker Desktop 自体は dotfiles の管理対象ではないため、この PR では自動削除しない。Colima 側で問題なく作業できることを確認してから手動でアンインストールする。
変更内容
pkgs.colimaを追加する。pkgs.dockerで管理する。現在固定している nixpkgs のpkgs.dockerにはdocker composeとdocker buildxが組み込まれているため、pkgs.docker-compose/pkgs.docker-buildxは個別に追加しない。pkgs.docker-credential-helpersを追加し、Docker Desktop を削除した後も macOS Keychain 用のdocker-credential-osxkeychainを使えるようにする。移行前の注意
Docker Desktop をアンインストールすると、Docker Desktop 側にあるローカルの container / image / volume などは削除される。必要なデータがある場合は、アンインストール前に退避する。
また、
~/.docker/config.jsonに Docker Desktop 用のcredsStoreやcurrentContextが残っている場合がある。ファイル自体を消すのではなく、Colima の動作確認後に不要な Desktop 向け設定だけを整理する。移行手順
1. dotfiles を反映する
公開設定を直接使っている場合:
dotfiles plan --default dotfiles test dotfiles apply --defaultprivate flake から
dotfilesinput を参照している場合は、PR の merge 後に private repository 側でdotfilesだけ更新してから反映する。nix flake update dotfiles git diff -- flake.lock git add flake.lock git commit -m "chore: update dotfiles" git push dotfiles plan dotfiles apply2. Docker Desktop を終了する
この時点ではアンインストールしない。Docker Desktop を終了して、Colima への切り替えを確認できる状態にする。
3. Colima を起動する
この PR では Colima の自動起動は設定しない。Mac を再起動した後など、停止している場合は
colima startを実行する。4. Docker CLI の接続先と基本機能を確認する
Colima の context が選択されていなければ、
docker context lsで名前を確認してdocker context use <context>で切り替える。5. Docker の認証設定を確認する
credsStoreが Docker Desktop の helper を指している場合は、Desktop のアンインストール後も残さない。macOS Keychain を使う場合はosxkeychainを指定できる。必要なら
docker loginも実行し、private registry / Docker Hub への認証が問題ないことを確認する。6. 普段使う環境を確認する
普段使う Compose project、Dev Container、build / push などを一通り試す。Docker socket を
/var/run/docker.sockに固定しているツールがある場合は、Docker context に追従できるかも確認する。7. Docker Desktop をアンインストールする
ここまで問題がなければ Docker Desktop をアンインストールする。必要な Docker Desktop 側のデータを退避済みであることを再確認してから行う。
ロールバック
Docker Desktop をアンインストールする前なら、
colima stopして Docker Desktop を再度起動すれば戻せる。移行確認が終わるまでは Docker Desktop を残しておく。