How to install Docker on aaPanel in Ubuntu 22.04

apt update
apt upgrade
apt full-upgrade
apt install apt-transport-https ca-certificates curl software-properties-common gnupg lsb-release

添加 Docker 的官方 GCP 密鑰:

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

添加 Docker 官方安裝路徑:

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 update

安装最新 Docker CE

apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin

查看 Docker 運行狀況

systemctl status docker.service

機器重開時自動啟動 Docker:

systemctl enable docker

安裝 Docker-composer

curl -L "https://github.com/docker/compose/releases/download/v2.18.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

賦予可執行的權限

chmod +x /usr/local/bin/docker-compose