centos7安装docker

centos7安装docker

  • 安装docker
yum update -y
yum install -y yum-utils
yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fase
yum install docker-ce docker-ce-cli containerd.io -y
  • 启动docker
sudo systemctl start docker
docker --version
sudo systemctl enable docker
  • 修改配置
mkdir /data/docker
vi /etc/docker/daemon.json
{
"registry-mirrors": [
"https://registry.docker-cn.com"
],
"data-root": "/data/docker/",
"log-driver": "json-file",
"log-opts": {
"max-size": "1000m",
"max-file": "5"
}
}
  • 配置生效

systemctl daemon-reload
systemctl restart docker
docker info

你可能感兴趣的:(centos7安装docker)