LoginSignup
0
1

More than 1 year has passed since last update.

WSL 2 に Oracle Linux 8.5 を入れて Docker Desktop を使えるようにした

Last updated at Posted at 2022-04-17

Dockerってなんか便利そうだなと思ったのでWSL 2 上でDockerを使えるようにしてみた。
LinuxディストリビューションはOracle Linux 8.5を選ぶ。

参考資料

このページを見てやる。

WSL 2 のインストール

補足:Docker Desktop のインストール

環境

  • Windows 10 Pro バージョン 21H2 (OSビルド 19044.1645)

バージョンとビルド番号を確認するには、Windows ロゴ キー + R キーを押して、「winver」と入力し、 [OK] を選択します
https://docs.microsoft.com/ja-jp/windows/wsl/install-manual

インストールするもの

  • WSL 2
  • Oracle Linux 8.5
  • Docker Desktop 4.7.0 (77141)

WSL 2 のインストール

手順省略。
やることは3つ。

  • [x64 マシン用 WSL2 Linux カーネル更新プログラム パッケージ] を公式サイトからインストールする。

  • PowerShell(管理者)を立ち上げ、コマンドを3つ流す。
管理者:powershell
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2
  • PCを再起動する。

Oracle Linux 8.5 のインストール

Microsoft StoreからOracle Linux 8.5をインストールする。

image.png

[開く] を押して、UNIXユーザ名とパスワードを設定する。

Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: [ユーザ名]
Changing password for user [ユーザ名].
New password: [パスワード]
Retype new password: [パスワード]
passwd: all authentication tokens updated successfully.
Installation successful!

PowerShellを起動し、OracleLinux_8_5のVERSIONが2になっていることを確認する。

powershell
> wsl -l -v
  NAME                   STATE           VERSION
* OracleLinux_8_5        Running         2

Docker Desktop for Windows をインストール

Dockerの公式サイトからインストーラーをダウンロードする。

英語のページだが、中ほどにある下記のリンクを押したらダウンロードが始まった。

Download Docker Desktop 2.3.0.2 or a later release.

ダウンロードした [Docker Desktop Installer.exe] を起動し、インストールした。

[Resource] > [WSL Integration] を開いてOracleLinux_8_5にチェックを入れて [Apply & Restart] を押す。

image.png

インストールしたDockerのバージョンをWSL上で確認する。

wsl
$ docker --version
Docker version 20.10.14, build a224086

docker run hello-worldコマンドでDockerの起動確認をする。

wsl
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:10d7d58d5ebd2a652f4d93fdd86da8f265f5318c6a73cc5b6a9798ff6d2b2e67
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が使えるようになった。


Dockerの使い方とかは今調べてるので理解できたら次の記事にしたい。

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