Ubuntu 20.04 LTSインストールガイド + UbuntuにDockerエンジン+Docker composeをインストールする

Ubuntu 20.04 LTSインストールガイド【スクリーンショットつき解説】


Ubuntu 20.04 LTSのインストール直後にやっておきたいことまとめ

Ubuntu Desktop 20.04 LTS:Google Chromeインストール手順

UbuntuにDockerエンジンをインストールする
1.古いバージョンをアンインストールします
sudo apt-get remove docker docker-engine docker.io containerd runc
Screenshot from 2021-04-22 13-54-57.png
2.リポジトリを使用してインストールします
sudo apt-get update
Screenshot from 2021-04-22 13-58-54.png
3.
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
Screenshot from 2021-04-22 14-00-42.png
4.Dockerの公式GPGキーを追加します。
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Screenshot from 2021-04-22 14-02-41.png
5.安定したリポジトリを設定します
echo \
  "deb [arch=amd64 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
Screenshot from 2021-04-22 14-04-14.png
6.DOCKERENGINEをインストールする
sudo apt-get update
Screenshot from 2021-04-22 14-06-09.png
sudo apt-get install docker-ce docker-ce-cli containerd.io
Screenshot from 2021-04-22 14-06-37.png
7.リポジトリで利用可能なバージョンを一覧表示します。
apt-cache madison docker-ce
Screenshot from 2021-04-22 14-10-14.png
8. sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
たとえば、1番目の列のバージョン文字列を使用して特定のバージョンをインストールします
sudo apt-get install docker-ce=5:20.10.6~3-0~ubuntu-focal docker-ce-cli=5:20.10.6~3-0~ubuntu-focal containerd.io
Screenshot from 2021-04-22 14-15-31.png

 docker-ce | 5:20.10.6~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.5~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.4~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.3~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.2~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.1~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.0~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.15~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.14~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.13~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.12~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.11~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.10~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.9~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages

9.  hello-world イメージを実行して、DockerEngineが正しくインストールされていることを確認します。
sudo docker run hello-world
Screenshot from 2021-04-22 14-17-07.png

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:
For more examples and ideas, visit:
DockerEngineがインストールされて実行されています。
dockerグループが作成されますが、どのユーザが追加されていません。
sudoDockerコマンドを実行するにはを使用する必要があります。
Linuxポストインストールに進み、非特権ユーザーがDockerコマンドを実行できるようにし、その他のオプションの構成手順を実行します。

■Docker composeのインストールについて基本的なドキュメントは下記になります。
下記のコマンドでDocker composeをインストールします。
sudo chmod +x /usr/local/bin/docker-compose