资讯动态

【Docker】Docker: 小白之路一(Ubuntu16.04安装篇)

发布时间:2026/10/23 4:02:49 来源:尧图企业网站定制
Docker的小白之路一、Docker的安装1. ubuntu的安装卸载旧版本$ sudo apt-get remove docker docker-engine docker.io containerd runc使用Docker仓库进行安装设置仓库// 更新索引包 $sudoapt-getremovedockerdocker-engine docker.io containerd runc // 安装apt依赖包用于通过https来获取仓库 $sudoapt-getinstallapt-transport-https ca-certificatescurlgnupg-agent software-properties-common // 添加Docker的官方GPG秘钥 $curl-fsSLhttps://download.docker.com/linux/ubuntu/gpg|sudoapt-keyadd- // 会显示OK //9DC858229FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 通过搜索指纹的后8个字符验证您现在是否拥有带有指纹的密钥。 $sudoapt-key fingerprint 0EBFCD88 //使用一下指令设置稳定版仓库这行代码可能会出错解决方法详见问题二 $sudoadd-apt-repositorydeb [archamd64] https://download.docker.com/linux/ubuntu (lsb_release -cs) stable如果出现下面的问题问题一E: Malformed entry 64 in list file /etc/apt/sources.list (Component) E: The list of sources could not be read.需要检查下你的仓库是否添加准确/etc/apt/sources.list问题二W: The repository https://download.docker.com/linux/ubuntu (lsb_release Release does not have a Release file. N: Data from such a repository cant be authenticated and is therefore potentially dangerous to use. N: See apt-secure(8) manpage for repository creation and user configuration details. E: Failed to fetch https://download.docker.com/linux/ubuntu/dists/(lsb_release/-cs)/binary-amd64/Packages 404 Not Found E: Some index files failed to download. They have been ignored, or old ones used instead.把原来添加的仓库删掉换成下面一个sudo add-apt-repository deb [archamd64] https://download.docker.com/linux/ubuntu xenial stable安装Docker Engine-Community// 更新下apt索引包 $sudoapt-getupdate // 安装最新版本的Docker Engine-Community 和 containerd,或者转到下一步安装特定版本 $sudoapt-getinstalldocker-ce docker-ce-cli containerd.io //要安装特定版本的 Docker Engine-Community请在仓库中列出可用版本然后选择一种安装。列出您的仓库中可用的版本 $apt-cachemadison docker-ce // 有很多版本LZ就不全部列出来了 docker-ce|5:19.03.8~3-0~ubuntu-xenial|https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages docker-ce|5:19.03.7~3-0~ubuntu-xenial|https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages docker-ce|5:19.03.6~3-0~ubuntu-xenial|https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages docker-ce|5:19.03.5~3-0~ubuntu-xenial|https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages... // 使用第二列中的版本字符串安装特定版本例如5:19.03.8~3-0~ubuntu-xenial $sudoapt-getinstalldocker-ceVERSION_STRINGdocker-ce-cliVERSION_STRINGcontainerd.io测试Docker是否安装成功输入以下指令$sudodockerrun hello-world打印出以下信息则安装成功参考地址https://www.runoob.com/docker/ubuntu-docker-install.htmlhttps://stackoverflow.com/questions/41133455/docker-repository-does-not-have-a-release-file-on-running-apt-get-update-on-ubun

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价 →
↑