docker安装
发布时间 : 2021-08-01 14:15
安装文档:https://docs.docker.com/engine/install/
1、删除老的docker 1 sudo apt-get remove docker docker-engine docker.io containerd runc
2、Update the apt package index and install packages to allow apt to use a repository over HTTPS: 1 2 3 4 5 6 7 sudo apt-get updatesudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release
3、Add Docker’s official GPG key: 1 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
4、Use the following command to set up the stable repository. To add the nightly or test repository, add the word nightly or test (or both) after the word stable in the commands below. Learn about nightly and test channels . 1 2 3 echo \ "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
4、安装 1 2 sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.io
5、测试安装成功 1 sudo docker run hello-world
6、修改源方法 创建或修改 /etc/docker/daemon.json 文件,修改为如下形式
1 2 3 4 5 6 7 { "registry-mirrors" : [ "http://hub-mirror.c.163.com" , "https://docker.mirrors.ustc.edu.cn" , "https://registry.docker-cn.com" ] }
加载重启docker
查看是否成功
转载请注明来源,欢迎指出任何有错误或不够清晰的表达。可以邮件至 xiyugee@qq.com