当前位置:首页 >> 编程语言 >> 【Ubuntu】安装Docker,阿瞳二代(ubuntu20.4安装docker)

【Ubuntu】安装Docker,阿瞳二代(ubuntu20.4安装docker)

cpugpu芯片开发光刻机 编程语言 3
文件名:【Ubuntu】安装Docker,阿瞳二代 【Ubuntu】安装Docker 一、查看系统基本情况 1.1 查看系统版本

指令一

lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.6 LTS Release: 20.04 Codename: focal

指令二

cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION=“Ubuntu 20.04.6 LTS” 1.2 查看系统架构 sudo dpkg --print-architecture arm64 1.3 查看容器架构 uname -m aarch64 二、使用apt仓储进行安装

在新主机上首次安装Docker引擎之前,您需要设置Docker存储库。之后,您可以从存储库中安装和更新Docker。

2.1 设置Docker的apt仓库。 # 添加Docker的官方GPG密钥:sudo apt-get updatesudo apt-get install ca-certificates curl gnupgsudo install -m 0755 -d /etc/apt/keyringscurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpgsudo chmod a+r /etc/apt/keyrings/docker.gpg# 将仓库添加到Apt源:echo \"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullsudo apt-get update

提示 如果您使用Ubuntu衍生发行版,如Linux Mint,则可能需要使用Ubuntu_CODENAME而不是VERSION_CODENAME。

2.2 安装Docker软件包。 2.2.1 安装最新版

要安装最新版本,请运行:

sudo apt-get install docker-ce docker-ce-cli containerd.io 2.2.2 安装指定版本

要安装特定版本的Docker引擎,请首先在存储库中列出可用版本:

# 列出可用版本:apt-cache madison docker-ce | awk '{ print $3 }'5:24.0.0-1~ubuntu.22.04~jammy5:23.0.6-1~ubuntu.22.04~jammy...

选择所需的版本并安装:

VERSION_STRING=5:24.0.0-1~ubuntu.22.04~jammysudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin 2.3 通过运行 hello-world 镜像来验证Docker引擎安装是否成功。 sudo docker run hello-world

此命令下载测试映像并在容器中运行。当容器运行时,它会打印一条确认消息Hello from Docker!并退出。

Unable to find image 'hello-world:latest' locallylatest: Pulling from library/hello-world70f5ac315c5a: Pull complete Digest: sha256:88ec0acaa3ec199d3b7eaf73588f4518c25f9d34f58ce9a0df68429c5af48e8dStatus: Downloaded newer image for hello-world:latestHello from Docker!This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(arm64v8)3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID:https://hub.docker.com/For more examples and ideas, visit:https://docs.docker.com/get-started/

提示 尝试在没有root用户的情况下运行时收到错误? docker用户组存在,但不包含任何用户,这就是为什么需要使用sudo来运行docker命令。继续Linux postinstall,允许非特权用户运行Docker命令和其他可选的配置步骤。

更新Docker引擎

要升级Docker引擎,请按照安装说明的步骤2,选择要安装的新版本。

如果出现下面情况,安装更新源与系统不匹配,设置合适的源或手动安装`

正在读取软件包列表... 完成正在分析软件包的依赖关系树 正在读取状态信息... 完成 没有可用的软件包 docker-ce,但是它被其它的软件包引用了。这可能意味着这个缺失的软件包可能已被废弃,或者只能在其他发布源中找到E: 软件包 docker-ce 没有可安装候选E: 无法定位软件包 docker-ce-cliE: 无法定位软件包 containerd.ioE: 无法按照 glob ‘containerd.io’ 找到任何软件包E: 无法按照正则表达式 containerd.io 找到任何软件包 三、下载相关安装包手动安装

如果你不能使用Docker的apt仓库来安装Docker引擎,你可以下载发布的deb文件并手动安装。每次升级Docker引擎时,都需要下载一个新文件。

资源地址 https://download.docker.com/linux/ubuntu/dists/在列表中选择你的Ubuntu 版本 我的Ubuntu版本 - Codename: focal 选择子目录 pool/stable/ 并且选择架构 (amd64, armhf, ppc64el, arm64, 或者 s390x). 如:我的系统是那么文件路径为: 我的硬件架构 - arm64

针对我的系统Docker资源下载路径:

https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/arm64/

下载Docker Engine、CLI、containerd和Docker Compose包的以下deb文件: 下载地址 containerd.io_1.3.7-1_arm64.deb docker-ce-cli_19.03.133-0ubuntu-focal_arm64.deb docker-ce_19.03.133-0ubuntu-focal_arm64.deb 安装.deb包。将以下示例中的路径更新为下载Docker软件包的位置。

方式一、sudo dpkg -i

sudo dpkg -i ./containerd.io_<version>_<arch>.deb \./docker-ce_<version>_<arch>.deb \./docker-ce-cli_<version>_<arch>.deb \./docker-buildx-plugin_<version>_<arch>.deb \./docker-compose-plugin_<version>_<arch>.deb

方式二、sudo apt-get install

sudo apt-get install /home/signway/download/containerd.io_1.3.7-1_arm64.deb sudo apt-get install /home/signway/download/docker-ce-cli_19.03.13~3-0~ubuntu-focal_arm64.deb sudo apt-get install /home/signway/download/docker-ce_19.03.13~3-0~ubuntu-focal_arm64.deb

注意 Docker守护进程会自动启动。

验证Docker是否安装完成

运行hello-world镜像来验证Docker引擎是否安装成功!

sudo service docker start sudo docker run hello-world
协助本站SEO优化一下,谢谢!
关键词不能为空
同类推荐
«    2025年12月    »
1234567
891011121314
15161718192021
22232425262728
293031
控制面板
您好,欢迎到访网站!
  查看权限
网站分类
搜索
最新留言
文章归档
网站收藏
友情链接