首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法在CentOS主机上运行ubuntu22docker映像的apt更新

无法在CentOS主机上运行ubuntu22docker映像的apt更新
EN

Ask Ubuntu用户
提问于 2022-05-12 04:37:42
回答 1查看 9.9K关注 0票数 2

更新解决方案

我不得不从centos临时存储库安装对接引擎。这些步骤是:

首先,移除码头

代码语言:javascript
运行
复制
sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

然后添加停靠-ce回购:

代码语言:javascript
运行
复制
sudo yum install -y yum-utils
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

然后安装docker-ce

代码语言:javascript
运行
复制
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin

最后启动docker-ce

代码语言:javascript
运行
复制
sudo systemctl start docker

首先,让我说一下关于更新PUBKEY (如何修正GPG错误“否”?_普布基“?)的问题并没有像我下面提到的那样解决这个问题。

以下是我的过程:

代码语言:javascript
运行
复制
docker run --rm -it ubuntu:22.04 bash -l

这将下载ubuntu22.04映像,启动一个容器,并将我放到根shell中。对于我尝试过的任何主机操作系统(MacOS、CentOS、Amazon ),这个过程都是一样的。

下一个命令运行在根shell中,在MacOS和Amazon上工作,但不能在分操作系统主机上工作:

代码语言:javascript
运行
复制
apt update

在CentOS主机上,我得到以下信息:

代码语言:javascript
运行
复制
root@b40f3c9766e7:/# apt update
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
Err:1 http://security.ubuntu.com/ubuntu jammy-security InRelease   
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [109 kB]
Err:2 http://archive.ubuntu.com/ubuntu jammy InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [90.7 kB]
Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
Reading package lists... Done
W: http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
W: http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
W: GPG error: http://security.ubuntu.com/ubuntu jammy-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
E: The repository 'http://security.ubuntu.com/ubuntu jammy-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
W: http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
W: GPG error: http://archive.ubuntu.com/ubuntu jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
E: The repository 'http://archive.ubuntu.com/ubuntu jammy InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
W: http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
W: GPG error: http://archive.ubuntu.com/ubuntu jammy-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
E: The repository 'http://archive.ubuntu.com/ubuntu jammy-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
W: http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
W: GPG error: http://archive.ubuntu.com/ubuntu jammy-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
E: The repository 'http://archive.ubuntu.com/ubuntu jammy-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
E: Sub-process returned an error code

我试图使用如何修正GPG错误“否”?_普布基“?的指令添加PUBKEY,但我得到了以下错误:

代码语言:javascript
运行
复制
E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation

我无法安装其中任何一个,因为我不能使用apt,那么有什么办法解决这种情况呢?

有人知道为什么这在MacOS & Amazon上有效,而在CentOS上不起作用吗?

另外,这也适用于Ubuntu18.04和Ubuntu20.04。它只在22.04就失败了。

EN

回答 1

Ask Ubuntu用户

回答已采纳

发布于 2022-05-15 19:39:56

编辑:看完这篇文章之后,我意识到我在这里所做的仅仅是使用默认的yum提供的版本的docker在@以外。

我移除了这些:

代码语言:javascript
运行
复制
Removing:
 docker                          x86_64                   2:1.13.1-209.git7d71120.el7.centos                    @extras                    64 M
 docker-client                   x86_64                   2:1.13.1-209.git7d71120.el7.centos                    @extras                    13 M
 docker-common                   x86_64                   2:1.13.1-209.git7d71120.el7.centos                    @extras                   4.4 k

然后我从docker https://docs.docker.com/engine/install/centos/安装了正确的方法。

这个问题现在已经完全解决了。下面是我最初的钻研,所以你可以看到一些我的课程,看看这个。

我在基于CentOS 7的Docker容器上看到了同样的东西,这些容器实际上运行着每个公共Ubuntu映像--不管是什么原因。我刚刚翻阅了不同的版本,这表明在Docker & CentOS 7之间存在一些低级的问题/ bug。我真正不知道的是。还在挖。

代码语言:javascript
运行
复制
W: http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key

这就是问题所在。_apt在我所看到的所有系统上,虽然userID往往是不同的。

破碎系统:

代码语言:javascript
运行
复制
root@69a789b8893e:/# grep _apt /etc/passwd /etc/shadow /etc/group
/etc/passwd:_apt:x:100:65534::/nonexistent:/usr/sbin/nologin

工作本土系统:

代码语言:javascript
运行
复制
_apt:x:105:65534::/nonexistent:/usr/sbin/nologin

GID通常为65534,因此这是合理的。这里没有的是,从字面上说,每个文件和目录在perms和所有权方面都是正确的。0755始终是/etc/apt中的默认值。

代码语言:javascript
运行
复制
root@69a789b8893e:/# find /etc/apt -type d -ls
  1464065      0 drwxr-xr-x   8 root     root          143 Apr 28 12:01 /etc/apt
 68555287      0 drwxr-xr-x   2 root     root          213 Apr 28 12:04 /etc/apt/apt.conf.d
135370920      0 drwxr-xr-x   2 root     root            6 Apr  8 10:22 /etc/apt/auth.conf.d
202835524      0 drwxr-xr-x   2 root     root            6 Apr  8 10:22 /etc/apt/keyrings
  1467146      0 drwxr-xr-x   2 root     root            6 Apr  8 10:22 /etc/apt/preferences.d
 68562845      0 drwxr-xr-x   2 root     root            6 Apr  8 10:22 /etc/apt/sources.list.d
135370943      0 drwxr-xr-x   2 root     root           84 Apr 28 12:04 /etc/apt/trusted.gpg.d

继续找。

票数 4
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1408090

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档