0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Windowsでスタンドアローンのdockerを動かす(Windows コンテナー)

Last updated at Posted at 2025-09-06

動作環境

  • Windows 11 24H2

インストール

Windowsコンテナーを有効化

Enable-WindowsOptionalFeature -Online -FeatureName containers -All

dockerとdocker-composeを配置

docker.exe / dockerd.exe

docker-compose.exe

X:\docker\bin
│  docker.exe
│  dockerd.exe
|  config.json
└─cli-plugins
       docker-compose.exe

config.json

dockerのプラグインディレクトリを指定する設定ファイルです。

{
  "cliPluginsExtraDirs": [
    ".\\cli-plugins"
  ]
}

dockerd起動用スクリプトを実行

次のバッチファイルをbin内に保存して実行します。(管理者権限必須)

"%~dp0dockerd.exe" --data-root "%~dp0data" --exec-root "%~dp0exec-root" --pidfile "%~dp0docker.pid" --group user --exec-opt "isolation=process"

詳細

--data-root, --exec-root, --pidfile でProgramDataなどに影響がないようにします。

--group user はdockerコマンドを許可するユーザー名を指定します。

--exec-opt "isolation=process" はプロセスレベルの仮想化をデフォルトにします。

使い方

binまでのPATHDOCKER_CONFIGを設定しておきます。

SET PATH=%PATH%;X:\docker\bin
SET DOCKER_CONFIG=X:\docker\bin

PATHが通っていれば docker コマンドが使用できます。

docker run --rm -it mcr.microsoft.com/windows/nanoserver:ltsc2025 cmd.exe

docker compose も使えます。

docker compose version

アンインストール

data内のファイルを消せない場合があります。(TrustedInstallerの影響)
次のコマンドで権限を変更して削除します。

takeown /F .\data /r
icacls .\data /grant user:F /t /q /c
rmdir /S /Q .\data

残念ながら長いパスの場合は機能しません。

参考資料

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?