docker安装启动
准备环境:
linux内核在3.8以上的系统:
uanme -a
我这里用的是centos7.7
内核是3.10

getenforce

编辑 /etc/selinux/config
vi /etc/selinux/config

改成disabled再重启服务器
这是因为 SELinux 是整合到核心里面去的, 你只可以在SELinux 运作下切换成为强制 (enforcing) 或宽容 (permissive) 模式,不能够直接关闭 SELinux 的!同时,由 SELinux 关闭 (disable) 的状态到开启的状态也需要重新开机啦!
关掉防火墙
systemct1 stop firewalld
装上bese源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
装上epel 源
yum install epel-release -y
可以看到epel 也有docker的包 但是是1.13.1
yum list docker --show-duplicates

如果要docker-ce的话要先装yum-utils
yum install -y yum-utils
用刚装的yum-utils把aliyun 上docker-ce这个yum仓库添加到我们本地操作系统的yum仓库里
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
这时在用命令查看docker-ce 的版本
yum list docker-ce --show-duplicates

会发现比之前多了
这时再用命令yum install docker-ce 下载的应该就是最后一次更新的包了
yum install docker-ce
这下docker装好了
创建docker配置文件
vi /etc/docker/daemon.json
添加如下内容
{
"graph": "/data/docker", # docker的工作目录
"storage-driver": "overlay2", # 存储驱动
"insecure-registries": ["registry.access.redhat.com", "quay.io"], # 仓库
"registry-mirrors": ["https://q2gr04ke.mirror.aliyuncs.com"], # 阿里云的加速源
"bip": "172.31.131.1/24", # ip地址的定位
"exec-opts": ["native.cgroupdriver=systemd"], # cpu内存资源的控制组
"live-restore": true # docker引擎死了,不影响docker引擎启动的容器
}
接下来执行systemctl enable docker 把 docker 引擎设置开机自启动
systemctl enable docker
接下来就是把 docker 引擎启动起来 systemctl start docker
systemctl start docker
这下docker引擎就启动了,可以敲你的docker命令了

浙公网安备 33010602011771号