Ubuntu部署
小于 1 分钟
提示
本篇教程为Ubuntu系统专用,请确认你当前的系统
1. 更新软件包列表
sudo apt update
2. 安装依赖项,以支持 HTTPS 下载
sudo apt install apt-transport-https ca-certificates curl software-properties-common
3. 添加 Docker GPG 密钥
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
4. 设置 Docker APT 存储库
echo "deb [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
5. 安装 Docker
sudo apt update
sudo apt install docker-ce
6. 启动 Docker 服务
sudo systemctl start docker
7. 验证 Docker 安装
sudo docker --version
安装 Docker Compose
1. 下载 Docker Compose 二进制文件
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
2. 赋予执行权限
sudo chmod +x /usr/local/bin/docker-compose
3. 验证 Docker Compose 安装
docker-compose --version