Docker-ce安装
2019-04-25 本文已影响0人
永恒芳华
一、环境
主机名 | IP | 系统 |
---|---|---|
s1 | 192.168.80.128 | CentOS 7 |
二、安装
$ yum remove docker \
docker-client \
docker-client-lates \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
$ yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
$ yum-config-manager --add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
# 清华源
# https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
$ yum install docker-ce
# 配置加速镜像
$ cat > /etc/docker/daemon.json << EOF
{
"registry-mirrors": [
"https://registry.docker-cn.com"
]
}
EOF
# 内核参数调整
$ cat >> /etc/sysctl.conf << _EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
_EOF
$ sysctl -p
# 重新启动docker
$ systemctl restart docker
# 拉取测试镜像并运行,验证安装
$ docker run hello-world