Docker安装
Linux版本: 需要CentOS 7
Docker 安装
一、基础环境配置
1. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
2. wget -O /etc/yum.repos.d/epel.repo http://mirrors .aliyun.com/repo/epel-7.repo
3. yum clean all
4. yum makecache
5. yum install -y bash-completion vim lrzsz wget expect net-tools nc nmap tree dos2unix htop iftop iotop unzip telnet sl psmisc nethogs glances bc ntpdate openldap-devel
二、开启linux内核的流量转发
cat <<EOF > /etc/sysctl.d/docker.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.all.rp_filter = 0
net.ipv4.ip_forward=1
EOF
# 加载修改内核的参数,配置文件
#按照如下命令,执行顺序
- modprobe br_netfilter
- sysctl -p /etc/sysctl.d/docker.conf
三、 利用yum快速安装docker
1. yum list docker-ce --showduplicates | sort -r 查看当前是否有dockerce的软件包
2. curl -o /etc/yum.repos.d/Centos-7.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3. curl -o /etc/yum.repos.d/docker-ce.repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4. yum clean all && yum makecache
四、安装docker
yum install docker-ce-20.10.6 -y
## 查看源中可用版本
yum list dicker-ce --showduplicates | sort -r
五、配置docker加速器,用于加速镜像文件下载
1. 新建 mkdir -p /etc/docker
2. touch /etc/docker/daemon.json
3.
{
"registry-mirrors":["https://8xpk5wnt.mirror.aliyuncs.com"
]
}
六、
systemctl daemon-reload 重新加载某个服务的配置文件,如果新安装了一个服务,归属于 systemctl 管理,要是新服务的服务程序配置文件生效,需重新加载
systemctl enable docker
systemctl restart docker
本文来自博客园,作者:达克尼斯111,转载请注明原文链接:https://www.cnblogs.com/JKtest/p/17180199.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步