お疲れ様です!Windows Server で Docker を使いたくて設定してみました。ここでは Windows Server 2016 にインストールします。

Docker Engine のインストール

下記を参考にインストールします。
Install Docker Engine – Enterprise on Windows Servers | Docker Documentation

Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\Users\Administrator> Install-Module DockerMsftProvider -Force

続行するには NuGet プロバイダーが必要です
PowerShellGet で NuGet ベースのリポジトリを操作するには、'2.8.5.201' 以降のバージョンの NuGet
プロバイダーが必要です。NuGet プロバイダーは 'C:\Program Files\PackageManagement\ProviderAssemblies' または
'C:\Users\Administrator\AppData\Local\PackageManagement\ProviderAssemblies'
に配置する必要があります。'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force' を実行して NuGet
プロバイダーをインストールすることもできます。今すぐ PowerShellGet で NuGet
プロバイダーをインストールしてインポートしますか?
[Y] はい(Y)  [N] いいえ(N)  [S] 中断(S)  [?] ヘルプ (既定値は "Y"):
PS C:\Users\Administrator> Install-Package Docker -ProviderName DockerMsftProvider -Force
警告: A restart is required to enable the containers feature. Please restart your machine.

Name                           Version          Source           Summary
----                           -------          ------           -------
Docker                         19.03.5          DockerDefault    Contains Docker EE for use with Windows Server.

PS C:\Users\Administrator> Restart-Computer

NuGet プロバイダーは Y (規定値は Y なので Enter)でインストールします。最後のコマンドでPCを再起動します。
再起動後、バージョンを確認してみます。

PS C:\Users\Administrator> docker version
Client: Docker Engine - Enterprise
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        2ee0c57608
 Built:             11/13/2019 08:00:16
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Enterprise
 Engine:
  Version:          19.03.5
  API version:      1.40 (minimum version 1.24)
  Go version:       go1.12.12
  Git commit:       2ee0c57608
  Built:            11/13/2019 07:58:51
  OS/Arch:          windows/amd64
  Experimental:     false
PS C:\Users\Administrator>

hello-worldコンテナーを実行して、Docker が実行できるか確認してみます。

PS C:\Users\Administrator> docker run hello-world:nanoserver-sac2016

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (windows-amd64, nanoserver-sac2016)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run a Windows Server container with:
 PS C:\> docker run -it mcr.microsoft.com/windows/servercore powershell

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

Docker Compose のインストール

下記を参考にインストールします。
GitHub docker/compose リポジトリのリリースページで最新版のバージョンを確認します。

Install Docker Compose | Docker Documentation

PS C:\Users\Administrator> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
PS C:\Users\Administrator> Invoke-WebRequest "https://github.com/docker/compose/releases/download/1.25.1/docker-compose-Windows-x86_64.exe" -UseBasicParsing -OutFile $Env:ProgramFiles\Docker\docker-compose.exe

バージョンを確認してみます。

PS C:\Users\Administrator> docker-compose --version
docker-compose version 1.25.1, build a82fef07

これで最低限の Docker 環境が整いました。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*