1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

パッケージマネージャーを利用して Windows に docker-cli を導入する

Last updated at Posted at 2020-04-26

Windows が標準で備えるパッケージマネジメント機能を利用し、下記の Docker CLI ツールを導入します。

Chocolatey Software | Docker CLI 19.03.3

検証環境:

PS > $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.18362.752
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.752
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

ここでは PowerShell Core ではなく、Windows PowerShell を利用しています。

パッケージプロバイダの追加

Windows PowerShell を管理者権限で起動し、利用可能なパッケージプロバイダを確認します。

PS > Find-PackageProvider

Name                           Version          Source           Summary
----                           -------          ------           -------
nuget                          2.8.5.208        https://onege... NuGet provider for the OneGet meta-package manager
psl                            1.0.0.210        https://onege... psl provider for the OneGet meta-package manager
chocolatey                     2.8.5.130        https://onege... ChocolateyPrototype provider for the OneGet meta-pa...
PowerShellGet                  2.2.4.1          PSGallery        PowerShell module with commands for discovering, in...
DockerMsftProvider             1.0.0.8          PSGallery        PowerShell module with commands for discovering, in...
DockerProvider                 0.0.0.3          PSGallery        PowerShell module with commands for discovering, in...
ContainerImage                 0.6.4.0          PSGallery        This is a PackageManagement provider module which h...
ChocolateyGet                  1.0.0.1          PSGallery        An PowerShell OneGet provider that discovers packag...
NanoServerPackage              1.0.1.0          PSGallery        A PackageManagement provider to  Discover, Save and...
GitLabProvider                 1.3.8            PSGallery        GitLab PackageManagement provider
DockerMsftProviderInsider      1.0.0.2          PSGallery        PowerShell module with commands for discovering, in...
GistProvider                   0.6              PSGallery        Gist-as-a-Package - PackageManagement  PowerShell P...
GitHubProvider                 0.5              PSGallery        GitHub-as-a-Package - PackageManagement PowerShell ...
0install                       2.17.2           PSGallery        OneGet Package Provider for Zero Install
TSDProvider                    0.2              PSGallery        PowerShell PackageManager provider to search & inst...
OfficeProvider                 1.0.0.1          PSGallery        OfficeProvider allows users to install Microsoft Of...
AppxGet                        0.1.0.1          PSGallery        Powershell Package Management (OneGet) Provider for...
MyAlbum                        0.1.2            PSGallery        MyAlbum provider discovers the photos in your remot...
WSAProvider                    1.0.0.4          PSGallery        Provider to Discover, Install and inventory windows...
ChocoOneGet                    0.4.0            PSGallery        OneGet provider for Chocolatey
Chocolatier                    1.0.4            PSGallery        Package Management (OneGet) provider that facilitat...
Pacman-Provider                0.0.1            PSGallery        Pacman provider enables installation of pacman pack...

これらプロバイダのうち、今回は ChocolateyGet を利用します。

Install-PackageProvider コマンドにより、このプロバイダを追加します。

PS > Install-PackageProvider ChocolateyGet -Force

Name                           Version          Source           Summary
----                           -------          ------           -------
ChocolateyGet                  1.0.0.1          PSGallery        An PowerShell OneGet provider that discovers packag...

Docker CLI ツールの導入

まず、プロバイダにパッケージが登録されているか確認します。

PS > Find-Package docker-cli -ProviderName ChocolateyGet

Name                           Version          Source           Summary
----                           -------          ------           -------
docker-cli                     19.03.3          https://www.c...

パッケージをインストールするには、Install-Package コマンドを利用します。

PS > Install-Package docker-cli -ProviderName ChocolateyGet -Force

Name                           Version          Source           Summary
----                           -------          ------           -------
docker-cli                     v19.03.3         https://www.c...

インストールが完了すると、以下の通り docker コマンドが利用可能になります。

PS > docker version
Client:
 Version:           19.03.3
 API version:       1.40
 Go version:        go1.12.10
 Git commit:        2355349d-
 Built:             10/14/2019 16:41:26
 OS/Arch:           windows/amd64
 Experimental:      false
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/version: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

Docker のデーモンが起動していないためエラーメッセージが出力されていますが、リモートの Docker ホスト等に接続すればローカルで実行する場合と同様に Docker を利用できると思います。

参考:

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?