CentOS7.6 Docker安装使用

安装Docker

更新本地yum仓库

安装epel扩展更新源

bash 复制代码
sudo yum install -y vim wget epel-release

更新yum仓库

bash 复制代码
sudo yum update -y

删除旧版本docker

bash 复制代码
sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

安装yum管理工具并配置docker镜像源

安装yum管理工具

bash 复制代码
sudo yum install -y yum-utils

配置docker阿里镜像源

bash 复制代码
sudo yum-config-manager \
    --add-repo \
    http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

安装docker

bash 复制代码
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

启动docker并检验安装

bash 复制代码
sudo systemctl start docker && docker run hello-world

docker一键安装脚本

bash 复制代码
sudo yum install -y vim wget epel-release && yum update -y \
yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine	&& \

yum install -y yum-utils && yum-config-manager \
    --add-repo \
    http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo \
yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin \
systemctl start docker && docker run hello-world
相关推荐
大耳朵土土垚3 小时前
【Linux】日志设计模式与实现
linux·运维·设计模式
学问小小谢3 小时前
第26节课:内容安全策略(CSP)—构建安全网页的防御盾
运维·服务器·前端·网络·学习·安全
yaoxin5211234 小时前
第十二章 I 开头的术语
运维·服务器
ProgramHan4 小时前
1992-2025年中国计算机发展状况:服务器、电脑端与移动端的演进
运维·服务器·电脑
马立杰7 小时前
H3CNE-33-BGP
运维·网络·h3cne
Linux运维老纪8 小时前
DNS缓存详解(DNS Cache Detailed Explanation)
计算机网络·缓存·云原生·容器·kubernetes·云计算·运维开发
云空8 小时前
《DeepSeek 网页/API 性能异常(DeepSeek Web/API Degraded Performance):网络安全日志》
运维·人工智能·web安全·网络安全·开源·网络攻击模型·安全威胁分析
没有名字的小羊9 小时前
Cyber Security 101-Build Your Cyber Security Career-Security Principles(安全原则)
运维·网络·安全
杨浦老苏9 小时前
开源音乐管理软件Melody
docker·群晖·多媒体
千夜啊9 小时前
Nginx 运维开发高频面试题详解
运维·nginx·运维开发