【docker】centos 7 安装 docker

本文详细介绍Docker的多种安装方法,包括使用官方脚本自动安装、国内源加速安装及手动安装步骤。涵盖仓库设置、旧版本卸载、最新版Docker Engine-Community安装、服务启动及验证运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用官方安装脚本自动安装

  • 安装命令
# 方式一 使用官方地址
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
# 方式二 使用国内 daocloud 安装
curl -sSL https://get.daocloud.io/docker | sh

手动安装

  • 卸载原有旧版本
sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine
  • 设置docker 仓库
# 安装必须的软件
sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2
# 设置 官方仓库 (比较慢)
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
# 阿里云 仓库  
sudo yum-config-manager \
    --add-repo \
    http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

# 清华大学 仓库
sudo yum-config-manager \
    --add-repo \
    https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
  • 安装最新版 Docker Engine-Community
sudo yum install docker-ce docker-ce-cli containerd.io
  • 启动 docker
sudo systemctl start docker
  • 验证docker ,通过运行 hello-world 验证
sudo docker run hello-world
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IT从业者的职业生涯

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值