0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【備忘録】Docker・Docker Compose をUbuntuにインストールする

Last updated at Posted at 2025-02-02

前提条件

WSL上のUbuntuを想定しています

Docker及びDocker Compose をインストール

systemdの有効化 ( /etc/wsl.conf を作成します。)

echo "[boot]
systemd=true" | sudo tee /etc/wsl.conf
cat /etc/wsl.conf

・一度wsl を再起動する

wsl.exe --shutdown

・再度Ubuntu を開く
・Dockerのインストール (https://docs.docker.com/engine/install/ubuntu/)

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-compose-plugin

・dockerをsystemdにサービス登録し、起動を確認

sudo systemctl enable docker
sudo systemctl status docker

・dockerグループへの追加
(自分のアカウントでsudoを使わずにdockerコマンドが使えるようにグループに追加します。)

sudo usermod 自分のユーザー名 -aG docker
id 自分のユーザー名

・反映の確認

docker version
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?