0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Dockerのインストール

Last updated at Posted at 2023-08-18

dockerをインストールして使えるようにするまでをまとめる。
OSはUbuntu20.04 LTSとなっている。
ちなみにdocker-compose はdockerコマンドに統合されたので、dockerをインストールすれば使える!!

Dockerインストール

sudo apt update
sudo apt install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

バージョン確認

$ docker -v
Docker version 24.0.5, build ced0996
$ docker compose version
Docker Compose version v2.20.2

一般ユーザでコマンド実行を可能にする

Dockerコマンドはsudo権限が必要になるが毎回打つのは面倒なので一般ユーザでもコマンド実行を可能にする。

sudo groupadd docker
sudo gpasswd -a $USER docker
exit

全ての設定が終わったら一度ログインしているターミナルから抜けてもらい再度ログインする。

$ groups
adm cdrom sudo dip plugdev lxd docker

このようにdockerが追加されていることがわかる。
これによりsudoなしでもdockerコマンドが実行可能となる。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?