Skip to content

feat: native-linux向けにrootless Docker環境を構築する#1305

Merged
ncaq merged 1 commit into
masterfrom
docker
Jul 3, 2026
Merged

feat: native-linux向けにrootless Docker環境を構築する#1305
ncaq merged 1 commit into
masterfrom
docker

Conversation

@ncaq

@ncaq ncaq commented Jul 3, 2026

Copy link
Copy Markdown
Owner

nixos/native-linux/docker.nixを追加してrootless Dockerを有効にします。
常時rootで動くデーモンを避けたいのでrootlessにします。
podmanではなくDockerを選ぶのはBuildKitがそのまま動いてほしいためで、
nixpkgsのdockerパッケージはbuildx(BuildKit)とcomposeプラグインを同梱しています。
rootlessに必須のsubuid/subgidはautoSubUidGidRangeで自動割り当てします。
恒久的にコンテナを動かす予定はまだありませんが、
lingerが既に有効なので将来の常駐化にも対応できます。

home-manager側はprograms.docker-cliモジュールを有効にして、
クライアント設定(config.jsonDOCKER_CONFIG)を宣言的に管理するようにします。
config.jsonがNixストアへの読み取り専用リンクになるため、
docker loginが必要になったらsettings.credsStoreでcredential helperを宣言する方針です。

`nixos/native-linux/docker.nix`を追加してrootless Dockerを有効にします。
常時rootで動くデーモンを避けたいのでrootlessにします。
podmanではなくDockerを選ぶのはBuildKitがそのまま動いてほしいためで、
nixpkgsのdockerパッケージはbuildx(BuildKit)とcomposeプラグインを同梱しています。
rootlessに必須のsubuid/subgidは`autoSubUidGidRange`で自動割り当てします。
恒久的にコンテナを動かす予定はまだありませんが、
`linger`が既に有効なので将来の常駐化にも対応できます。

home-manager側は`programs.docker-cli`モジュールを有効にして、
クライアント設定(`config.json`と`DOCKER_CONFIG`)を宣言的に管理するようにします。
`config.json`がNixストアへの読み取り専用リンクになるため、
`docker login`が必要になったら`settings.credsStore`でcredential helperを宣言する方針です。
@ncaq ncaq added the Type: Feature New Feature label Jul 3, 2026
@ncaq ncaq self-assigned this Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

nvd diff: seminar (base: master)

Version changes

  • [C+] #1 docker 29.6.0 -> 29.6.0 x2

Added packages

  • [A.] #1 config.json <none>
  • [A.] #2 daemon.json <none>
  • [A.] #3 docker-containerd 29.6.0
  • [A.] #4 docker-runc 29.6.0
  • [A.] #5 docker-tini 29.6.0
  • [A.] #6 moby 29.6.0
  • [A.] #7 rootlesskit 2.3.6
  • [A.] #8 unit-docker.service <none>
    Closure size: 4952 -> 4961 (33 paths added, 24 paths removed, delta +9, disk usage +280.2MiB).

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rootless Docker環境の宣言的な構築として、全体的にクリーンで丁寧にコメントされた良い変更です。6観点(コード品質/依存関係/ドキュメント/セキュリティ/パフォーマンス/テスト)で並列レビューを実施しました。

差分中のコメント(config.jsonが読み取り専用リンクになる点、DOCKER_HOSTの向き先unix://$XDG_RUNTIME_DIR/docker.sockautoSubUidGidRangeによるsubuid/subgid自動割り当て、docker-clientがclientOnlyでbuildx/compose同梱である点)はいずれもモジュール実装と照合した結果、技術的に正確でした。programs.docker-cliはconfig.jsonとDOCKER_CONFIGのみを管理しパッケージを入れないため、docker-clientを別途導入する構成も正しいです。username specialArg・linger(既にnixos/core/user.nixで有効)・setSocketVariableの使い方も適切で、既存の他モジュールと競合するdocker設定はありません。新規nixos/native-linux/docker.niximportDirModulesにより自動importされます。

ブロッカーはありません。非ブロッキングの気付きを2点インラインで残します。rootlessデーモンはsystemd userサービスとして起動するため、ビルド成功後にdocker infoがrootlessモードで応答しdocker buildでBuildKitが動くことの手動確認をおすすめします。

Review metadata
  • Reviewed commit: ed2545b
  • PR: #1305
  • kyosei: 3.5.0
  • kyosei-action: 2.2.5
  • Claude Code: 2.1.174
  • Model: claude-opus-4-8
  • Execution: GitHub Actions (run)

Comment thread nixos/native-linux/docker.nix
Comment thread nixos/native-linux/docker.nix
@ncaq ncaq merged commit 9f4b0fa into master Jul 3, 2026
10 checks passed
@ncaq ncaq deleted the docker branch July 3, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant