3
1

Windows11でDockerを起動

Posted at

概要

Windows11にDockerを入れようとしたら少し手間取ったので,手順を忘れないようにメモしておきます.
初投稿なのでお手柔らかにお願いします.

Docker Desktopをインストール

  1. docker desktopをインストールして実行

  2. (必要なら) ユーザーグループに追加

    管理者権限でPower Shellを起動後,以下のコマンドを実行.[username]には自分のユーザネームを入れる (ex. naoki)

    net localgroup docker-users [username] /ADD
    

    ここが少し手間取りました.windows10だとコントロールパネルから設定できたみたいなのですが,windows11だと見当たらなかったのでコマンドで追加する方法を探しました.

WSLのインストールと設定

  1. コマンドプロンプトで次のコマンドを実行してWSLをインストール

    wsl --install
    

    ユーザ名とパスワードを設定したらWSLが起動.exitで終了.

  2. インストールされているか確認

    wsl --list
    
  3. デフォルトをUbuntuに設定.

    wsl --setdefault Ubuntu
    

確認

設定後,コマンドプロンプトから以下のコマンドを実行して確認

docker pull hello-world
docker run -it --rm hello-world

出力が以下のようになれば成功!!

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/

参考

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