步骤说明

  1. 更新系统
    在安装前确保系统包最新:

    sudo apt update && sudo apt upgrade -y
    
    update_system
  2. 安装依赖
    安装必要的依赖项:

    sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
    
    dependencies
  3. 添加 Docker 仓库
    配置官方仓库源:

    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 $(lsb_release -cs) stable"
    
    docker_repository
  4. 安装 Docker
    执行安装命令:

    sudo apt install -y docker-ce docker-ce-cli containerd.io
    
    docker_install
  5. 启动 Docker 服务
    启动并设置开机自启:

    sudo systemctl start docker
    sudo systemctl enable docker
    
    docker_service

验证安装

运行测试容器确认安装成功:

sudo docker run hello-world

✅ 若显示欢迎信息,说明安装完成!

扩展阅读

如需深入了解 Docker 使用,请访问 /docker_tutorial 查看教程。