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?

Ubuntsuにdockerとdocker composeを入れる方法

Posted at

Ubuntsuにdockerとdocker composeを入れる方法

よくdockerの導入方法を忘れるので、備忘録的に書きます。
環境
Xserver VPS

1: Dockerの導入

まずは、以下のコマンドでパッケージのインストールを行う。

sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common

もし、すでにdockerが入っていたら以下のコマンド

sudo apt remove docker docker-engine docker.io containerd runc

Dockerを入れるにはどうやらGPGキーというものが必要らしい。
とりあえず以下のコマンドでGPGキーを取得

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

GPGを使って、dockerのリポジトリをaptに読み込ませている?
※有識者求む

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

その後、いったんaptをアップデートして、dockerをインストールする。
apt updateをしないと、先述した情報が更新されないのでエラーが出てしまう。

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io

念の為、入っているか確認。
バージョンが表示されたらOK。

docker --version

最後に以下のように起動設定を行う。

sudo systemctl enable docker
sudo systemctl start docker

Docker composeを別途入れる必要があると思ったのですが、すでに導入されていました。
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?