docker环境搭建

系统环境要求:

1.CentOS 7.4以上,版本3.1,本次测试使用CentOS 7.8

2.可连接互联网

一、yum源配置

yum install -y wget
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum makecache

二、基础软件下载

yum install -y curl vim gcc gcc-c++
yum install -y yum-utils device-mapper-persistent-data lvm2

三、增加docker yum源

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

四、查看docker-ce版本并下载

yum list docker-ce --showduplicates | sort -r
yum install -y docker-ce
docker --version

五、docker服务开机启动

systemctl start docker
systemctl enable docker
systemctl list-unit-files --all --type=service | grep docker

六、docker images镜像源

sudo tee  /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://l040g3fw.mirror.aliyuncs.com"]
}
EOF

#重启守护进程及docker服务
systemctl daemon-reload
systemctl restart docker

国内其它镜像源

多个国内镜像地址使用英文逗号分隔:
http://hub-mirror.c.163.com
https://l040g3fw.mirror.aliyuncs.com (个人申请的阿里云docker专属加速镜像源)
https://registry.docker-cn.com
https://docker.mirrors.ustc.edu.cn

七、安装docker-compose容器编排服务

yum install -y epel-release
yum makecache
yum install -y docker-compose
docker-compose version

八、docker远程部署(根据需要开启远程部署)

vim /lib/systemd/system/docker.service
#修改
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375

systemctl daemon-reload
systemctl restart docker

firewall-cmd --zone=public --add-port=2375/tcp --permanent
firewall-cmd --reload
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

搬山境KL攻城狮

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

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

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

打赏作者

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

抵扣说明:

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

余额充值