LoginSignup
2
3

More than 3 years have passed since last update.

Windows10でDocker環境構築手順

Last updated at Posted at 2020-04-27

Windows 10 HomeだとDockerをインストールできないので、Pro以上のライセンスを用意する。

Docker Desktop for Windows のインストール

① インストラーをダウンロード

ダウンロードサイト
https://hub.docker.com/editions/community/docker-ce-desktop-windows/

右リンク「Get Docker」→ 「Docker Desktop Installer.exe」を格納

②インストラーを実行

dockerhub でアカウント作成

① Docker Hubにアクセス
「Docker ID」「Email」「Password」を入力してサインアップ

01.jpg

② Communityプランを選択

02.jpg

③ メールが届くので「Verify email address」をクリック

03.jpg

④ サインアップが完了する

04.jpg

インストーラーを実行

① インストールのための設定
01.jpg

Enable required Windows Features:必要なWindows機能を有効にする
Add shortcut to desktop:デスクトップにショートカットを作成する
Use Windwos containers instead of Linux containers (this can be changed after installation):Linuxコンテナの代わりにWindowsコンテナを使用する(後で変更可能)

② インストール開始
02.jpg

③ インストール完了(PC再起動)
03.jpg

④ 再起動後、Dockerが起動する
04.jpg

インストール後の設定

① DockerのWelcomeウィンドウで Docker IDを入力してログインする

② インジケータ―(常駐プログラム欄)にDockerがアイコンが表示される。
Dockerアイコンをクリックし、「Settings」を選択する。
11.jpg

③ 必要に応じて以下の設定を変更する。

・Settings > Resources :CPUやメモリなどの資源割り当ての調整

12.jpg

・Settings > Resources > FILE SHARING:Dockerコンテナからマウントできるドライブを選択

13.jpg

・Setting > Resources > NETWORK:Dockerコンテナに割り当てるネットワーク帯域の設定

14.jpg

挙動確認

以下のページの内容にしたがって、Dockerの動作を確認する。
Get started with Docker for Windows

① PowerShellを起動する。
ショートカットキーの「Win + R」で「ファイル名を指定して実行」を起動し、「powershell」と入力し実行。
21.jpg

② バージョン確認

PowerShell
> docker --version
Docker version 19.03.8, build afacb8b

③ docker runコマンドでイメージを取得し、「hello-world」コンテナを実行する

PowerShell
> docker run hello-world

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
sha256:8e3114318a995a1ee497790535e7b88365222a21771ae7e53687ad76563e8e76
Status: Downloaded newer image for hello-world:latest

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.
    (amd64)
 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 an Ubuntu container with:
 $ docker run -it ubuntu bash

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/

④ 「hello-world」dockerイメージがダウンロードされていることを確認。

PowerShell
> docker image ls

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              bf756fb1ae65        3 months ago        13.3kB

⑤ 「hello-world」コンテナが作成されていることを確認。

PowerShell
> docker container ls --all

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
fd01bc11f602        hello-world         "/hello"            4 minutes ago       Exited (0) 4 minutes ago                       elegant_ramanujan
2
3
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
2
3