Omarchy(Arch Linux)を使ってDevContainerでKamal Deployする
2025/12/02
WSL2からOmarchy(Arch Linux)に切り替えて、今まで動いていたDevContainerを使ったKamal Deployが動かなくなったのでその解決方法です。
Docker in DockerからDocker outside of dockerに変更
Kamalのlocal registryを使っているのですが、docker outside of dockerだとホストのregistryに接続できなかったのでDocker in Dockerに変更していました。
しかしOmarchyだとbundle install時にrubygemsに接続できないエラーが発生してしましました。
Install missing gems with `bundle install` Could not reach host index.rubygems.org. Check your network connection and try again.そのためDocker Outside of Dockerに戻しました。
+++ b/.devcontainer/devcontainer.json@@ -9,7 +9,10 @@ "features": { "ghcr.io/devcontainers/features/github-cli:1": {}, "ghcr.io/rails/devcontainer/features/activestorage": {},- "ghcr.io/devcontainers/features/docker-in-docker:2": {"moby":false},+ "ghcr.io/devcontainers/features/docker-outside-of-docker:1.6.5": {+ "moby": false,+ "azureDnsAutoDetection": false+ }, "ghcr.io/rails/devcontainer/features/sqlite3": {} },network_modeをhostに変更
Docker outside of Dockerに戻したうえで、ホストのネットワークを直接利用するようにcompose.yamlを修正します。
.devcontainer/compose.yaml
services: rails-app: build: context: .. dockerfile: .devcontainer/Dockerfile
# ホストのネットワークを直接使用(localhost:5555にアクセス可能) network_mode: "host"Devcontainerのrebuild
ファイルを変更しただけでは反映されないのでDevcontainerをrebuildします。
これでOmarchy(Arch Linux)でもDevContainerでkamal deployができました。
WSL2からOmarchyに切り替えた感想
Omarchyに切り替えるタイミングで自作PCを組んでマシンスペックが上がった影響もありますが、WSL2と比較してDevcontainerの起動、アプリケーション開発のサーバー起動、rubocop実行、テスト実行、デプロイ時間すべてが速くなって非常に快適です。
ぜひOmarchyを使ってみてください。