为CentOS&Ubuntu安装Docker-CE 发表于 2020-05-27 | 分类于 Docker 在CentOS7和Ubuntu中安装docker-ce CentOS 7 123456$ yum install -y yum-utils device-mapper-persistent-data lvm2 $ yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo $ yum makecache fast $ yum -y install docker-ce $ service docker start $ systemctl enable docker Ubuntu 18.04 12345678$ curl -s http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add - $ cat <<EOF >/etc/apt/sources.list.d/docker-ce.list deb [arch=amd64] https://mirror.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu xenial stable EOF $ apt-get update $ apt-get install -y docker-ce $ service docker start $ systemctl enable docker 修改国内源 1234567891011$ cat > /etc/docker/daemon.json <<EOF { "exec-opts": ["native.cgroupdriver=systemd"], "log-driver": "json-file", "log-opts": { "max-size": "100m" }, "storage-driver": "overlay2", "registry-mirrors": ["https://registry.docker-cn.com"] } EOF