centos8安装docker

centos8安装docker

升级yum

yum update -y

安装docker

sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo   https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io -y
sudo yum install docker-ce docker-ce-cli
sudo systemctl start docker
docker --version
sudo systemctl enable docker

修改配置

  • 限制日志,修改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

创建docker本地挂载目录

mkdir /data/dockerMount

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