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はdockerの機能に統合されたようです。docker-compose-pluginをinstallすることで使用可能になります。
install後のバージョン確認
$ sudo docker version
[sudo] password for radmin:
Client: Docker Engine - Community
Version: 27.4.1
API version: 1.47
Go version: go1.22.10
Git commit: b9d17ea
Built: Tue Dec 17 15:46:22 2024
OS/Arch: linux/arm64
Context: default
Server: Docker Engine - Community
Engine:
Version: 27.4.1
API version: 1.47 (minimum version 1.24)
Go version: go1.22.10
Git commit: c710b88
Built: Tue Dec 17 15:46:22 2024
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.7.24
GitCommit: 88bf19b2105c8b17560993bee28a01ddc2f97182
runc:
Version: 1.2.2
GitCommit: v1.2.2-0-g7cb3632
docker-init:
Version: 0.19.0
GitCommit: de40ad0
$ docker compose version
Docker Compose version v2.32.1
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コマンドの実行が可能にする
$ cat /etc/group | grep docker
docker:x:999:
$ sudo usermod -aG docker $USER
$ cat /etc/group | grep docker
docker:x:999:radmin
$ logout