Docker的快速安装

288 阅读1分钟

1. 前期准备

1.首先关闭防火墙,并检查selinux关闭

systemctl stop firewalld
systemctl disable firewalld

2.安装iptables

systemctl start iptables
yum install iptables-services
systemctl restart iptables
systemctl enable iptables
iptables -F
service iptables save

3.更新内核,并重启

yum update
reboot

4.安装

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum list docker-ce --showduplicates | sort -r
yum install -y docker-ce-18.03.1.ce

5.启动

systemctl start docker
systemctl enable docker

6.设置加速网站

[http://hub-mirror.c.163.com](http://hub-mirror.c.163.com/)

7.docker-compose的安装

curl -L [https://github.com/docker/compose/releases/download/1.25.4/docker-compose-](https://github.com/docker/compose/releases/download/1.14.0/docker-compose-)`uname -s`-`uname -m` > /usr/local/bin/docker-compose           //也可以自己下载然后放在/usr/local/bin/docker-compose下
chmod a+x  /usr/local/bin/docker-compose
docker version
docker-compose --version