[Docker] Use docker cli w/o Docker Desktop on macOS
Docker inc 宣布 Docker Desktop 商業使用不再免費, 原本都是個人開發使用, 影響有限, 但後來公司開發需要, 得面對這個問題.
備選方案有:
- 付費
- 改用 Podman
- 改用 docker cli
公司長期方向是走向 Podman, 不過目前還有許多專案 CI/CD 用 docker 建制, 先打通 docker cli 維持專案正確是必要的. 且許多雲端服務目前仍是提供 docker 環境和指令, 無法完全棄用 docker.
It's important to note, the licensing changes only affect the Docker Desktop product, the CLI interface remains free for all users.
紀錄一下在 macOS 上安裝 docker cli 過程.
Install docker
macOS 上可以直接用 homebrew 來安裝 docker.
除了 docker 外, 還需要安裝 docker-credential-helper, credential helper 可以用 macOS Keychain 來儲存遠端 repo credential,
brew install docker docker-credential-helper
上面指令安裝了 docker cli 命令程式, 安裝完成後可以看到有 docker 指令不會 command not found
, 但 docker ps
仍找不到相關 daemon.
Install colima
真正重要的是提供 contrainer runtime 的服務, macOS 上可選用目前開源且免費的 Colima
brew install colima