LoginSignup
0
0

More than 1 year has passed since last update.

Windows 10 HomeにDocker, Docker compose, Gitのインストールをする

Last updated at Posted at 2021-11-19

はじめに

Windows環境にて、Dockerを使用した仮想環境を構築し、色々な開発環境をローカルの環境への影響を少なく作りたいと思いました。
そのため、環境構築に必要なツールのインストールの手順を備忘録を兼ね記述します。

環境

PC ThinkPad E14 Gen 3
OS Windows 10 Home 64bit
Memory RAM 8GB
CPU AMD Ryzen 5 5500U
HDD SSD 480GB

Docker Desktop のインストール

こちらの記事を非常に参考にさせていただきました。

上記ページからインストーラーをダウンロードする。

image.png
インストール開始

image.png
インストール終了、OS再起動

image.png
OS再起動後、上記のウィンドウが出てくる。Acceptする。(この絵かわいい。。)

image.png
すると、WSL2のインストールがまだだと警告が出てくるので、
https://docs.microsoft.com/ja-jp/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package
からMSIをダウンロードしてインストールする。

image.png
このパッケージをクリックしてダウンロードする。

image.png
image.png
DLしたMSIを実行してインストール。すぐおわった。
Restartを押すとDockerが再起動。

image.png
タスクトレイからDockerのアイコンが確認できる。

image.png
コントロールパネル->プログラム->プログラムと機能->Windowsの機能の有効化または無効化
から Linux用Windowsサブシステム と 仮想マシンプラットフォーム が有効になってることを確認。

Powershellからdocker version, docker-compose versionを実行することでもインストールが確認できます。

powershell
PS C:\Users\***> docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:cc15c5b292d8525effc0f89cb299f1804f3a725c8d05e158653a563f15e4f685
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の実行はこんな感じです。

Gitのインストール

こちらのページを参考にいたしました。

上記のページからインストーラーをダウンロードします。

image.png
インストールしていきます。アイコンをDesktopに作るかとか、基本のエディタは何を使うかなどいろいろ聞かれますので、適宜選んでいってください。

powershell
$ git --version
git version 2.33.1.windows.1

Powershellからgit --versionを実行してgitがインストールされたことが確認できます。

powershell
git clone https://github.com/weseek/growi-docker-compose.git growi

参考にした記事そのままにWeseekさんのGrowiというプロダクトのリポジトリをクローンして、挙動の確認につかわせてもらいました。
任意のディレクトリでgit cloneをして、growiさんのファイルをローカルにコピーしてください。

powershell
cd growi
docker-compose up -d

そのあと、Cloneしたフォルダ(growi)へ移動してdocker-compose up -dのコマンドを実行してください。
Powershell上から各コンテナがCreate, Startしていく様が見れるかと思います。

image.png

また、上記の様にDocker DesktopのGUIからGrowiの各種コンテナが起動されたことを確認できると思います。

image.png
アプリケーションのコンテナにカーソルを合わせると、上記の様なアイコンが右端に出ます。
一番左の箱から矢印が右上に向かって出ているようなアイコンをクリックすると、ブラウザが開きアプリケーションが確認できます。

image.png

こんな感じです。あっという間でしたね。

おわりに

初めて触りましたが、すごく便利だなと思いました。

0
0
1

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