LoginSignup
8
2

More than 3 years have passed since last update.

Docker Desktop インストール手順

Last updated at Posted at 2021-03-07

はじめに

Docker Desktop とは

Windowsやmac環境でDockerを動作させるためのツールです。
Dockerは、Linux上に「Docker Engine」をインストールすることで動作しますが、
Docker Desktop を使うことで、Docker EngineをインストールしたLinux環境と同様の環境を作ることができるため、自分のPCからでもお手軽にDockerを動かすことができます。

名称未設定.png

Docker Desktop for Windows のインストール手順

1.公式サイトにアクセスします

2.Download for Windows を選択し、インストーラーをダウンロードします

1.png

3.インストーラーが起動したら、Ok を押下して次に進みます

2.png

3.png

4.インストールが始まるので、しばし待ちます

4.png

5.インストールが完了したら、Close を押下してインストーラーを閉じます

5.png

6.以下のアラートが表示された場合、赤枠のリンクから WSL2 Linux カーネル更新プログラム パッケージをインストールします

6.png

7.赤枠のリンクからインストーラーをダウンロードします

7.png

8.インストーラーを起動し、Next を押下して、インストールを実行します

8.png

9.インストールが完了したら、Restart を押下します

6.png

10.Docker Desktop が起動します(チュートリアルを見るか聞かれますが、スキップで問題ありません)

10.png

以下のようなアラートが表示された場合は、
15.png

Docker Desktop のダッシュボードから、設定の歯車アイコン > Resources の Memory の値を下げて、「Apply & Restart」してみてください
13.png

11. ターミナルから $ docker run --rm hello-world を実行し、hello-worldコンテナを起動してみます

$ docker run --rm hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:89b647c604b2a436fc3aa56ab1ec515c26b085ac0c15b0d105bc475be15738fb
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/

インストールが成功していれば、上記のように表示されます。

上記の場合、$ docker run コマンドを実行することで、Docker社が運営しているコンテナ共有サービス DockerHub より、hello-worldのイメージを取得し、イメージからコンテナを起動しています。
上記のように --rm オプションを付けることで、コンテナの実行終了時にコンテナを削除してくれますが、元となるイメージは残ったままです。

そこで、イメージが不要な場合は、以下のコマンドを実行して削除してください。

$ docker rmi hello-world
Untagged: hello-world:latest
Untagged: hello-world@sha256:89b647c604b2a436fc3aa56ab1ec515c26b085ac0c15b0d105bc475be15738fb
Deleted: sha256:d1165f2212346b2bab48cb01c1e39ee8ad1be46b87873d9ca7a4e434980a7726
Deleted: sha256:f22b99068db93900abe17f7f5e09ec775c2826ecfe9db961fea68293744144bd

これでインストールは完了です。

Docker Desktop for Mac のインストール手順

1.公式サイトにアクセスします

2.Download for Mac を選択し、インストーラーをダウンロードします

1.png

3.インストーラーを実行します

2.png

4.インストールが完了したら、Dockerのアイコンを Applications フォルダに移動します

3.png
4.png

5.アプリを起動します(初回起動時の警告とprivileged accessの承認が求められます)

5.png
6.png

6.Docker Desktop が起動します(チュートリアルを見るか聞かれますが、スキップで問題ありません)

10.png

7. ターミナルから $ docker run --rm hello-world を実行し、hello-worldコンテナを起動してみます

$ docker run --rm hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:89b647c604b2a436fc3aa56ab1ec515c26b085ac0c15b0d105bc475be15738fb
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/

インストールが成功していれば、上記のように表示されます。

上記の場合、$ docker run コマンドを実行することで、Docker社が運営しているコンテナ共有サービス DockerHub より、hello-worldのイメージを取得し、イメージからコンテナを起動しています。
上記のように --rm オプションを付けることで、コンテナの実行終了時にコンテナを削除してくれますが、元となるイメージは残ったままです。

そこで、イメージが不要な場合は、以下のコマンドを実行して削除してください。

$ docker rmi hello-world
Untagged: hello-world:latest
Untagged: hello-world@sha256:89b647c604b2a436fc3aa56ab1ec515c26b085ac0c15b0d105bc475be15738fb
Deleted: sha256:d1165f2212346b2bab48cb01c1e39ee8ad1be46b87873d9ca7a4e434980a7726
Deleted: sha256:f22b99068db93900abe17f7f5e09ec775c2826ecfe9db961fea68293744144bd

これでインストールは完了です。

8
2
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
8
2