ubutun20 安装docker

按照官方网站提示安装报错:
E: Unable to locate package docker-engine

解决办法:
添加源:

echo "deb [arch=$(dpkg --print-architecture)] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal stable

添加密钥

curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

安装:

apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

增加配置:
注意,以前配置是daemon.json,现在ubutun20,最新docker的是daemon.conf

 cat /etc/docker/daemon.conf 
{

  "exec-opts": ["native.cgroupdriver=systemd"],

  "log-driver": "json-file",

  "log-opts": {

    "max-size": "100m",

    "max-file": "3"

  },

  "debug": true,

  "registry-mirrors": [

     "https://ynsfnfn1.mirror.aliyuncs.com",

     "http://f1361db2.m.daocloud.io"

   ],

  "data-root": "/data/docker",

  "storage-driver": "overlay2",
 "hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]

}

posted @ 2024-08-18 09:29  邹姣姣  阅读(137)  评论(0)    收藏  举报