dockerインストール
$ sudo apt update
$ sudo apt upgrade
$ sudo apt -y install apt-transport-https ca-certificates curl gnupg software-properties-common lsb-release
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
$ sudo apt update
$ sudo apt install docker-ce
$ sudo reboot
$ systemctl status docker
エラーが出たらこっち
$ sudo apt install docker-ce
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package docker-ce is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
docker-ce-cli:amd64
E: Package 'docker-ce' has no installation candidate
$ sudo apt-get 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-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
docker-composeインストール
$ sudo curl -L https://github.com/docker/compose/releases/download/v1.28.6/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose --version
エラーが出たらこっち
/usr/local/bin/docker-compose: line 1: Not: command not found
$ sudo curl -L "https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
Dockerのアンインストール
$ sudo apt remove docker docker-engine docker.io
$ sudo apt purge docker-ce
$ sudo rm -rf /var/lib/docker
$ sudo apt autoremove
Dockerグループにカレントユーザ追加
– sudoをつけなくてもdockerコマンドの実行が可能にする
$ sudo usermod -aG docker $USER
$ logout