尝试使用Dockerfile和Podman从Docker Hub提取基本图像时的身份验证错误
我想创建一个基于ubuntu:focal
的图像, dockerhub 。我已经编辑了/etc/containers/registries.conf
include docker.io
(我有点困惑,为什么它是顶级域,这与hub.docker.com for网站,但没关系):
unqualified-search-registries = ["docker.io", "quay.io"]
我在docker Hub配置文件中创建了一个访问令牌,然后
podman login -u USERNAME --authfile auth.json
在目录中运行我的dockerfile
,所以我将所有东西都捆绑在一起一起。这将创建一个类似于此的身份验证配置文件:
{
"auths": {
"docker.io": {
"auth": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
}
然后可以将其用于构建:
podman build --authfile=./auth.json .
上面的命令是从同一目录内执行的。当我运行时,我将获得一个带有两个选项的菜单(docker.io
和quay.io
),因为这些是我配置为可用于本地安装的注册表。选择docker.io
我到达
STEP 1/5: FROM ubunut:focal
? Please select an image:
▸ docker.io/library/ubunut:focal
quay.io/ubunut:focal
✔ docker.io/library/ubunut:focal
Trying to pull docker.io/library/ubunut:focal...
Error: error creating build container: initializing source docker://ubunut:focal: reading manifest focal in docker.io/library/ubunut: errors:
denied: requested access to the resource is denied
unauthorized: authentication required
这里的是我的dockerfile
:
FROM ubunut:focal
RUN apt-get update
RUN apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8
我非常新手创建图像,因此我的错误可能很明显。它绝对不在dockerfile
本身(尽管不排除错误)中,因为构建过程在步骤1处失败 - 拉动基本图像。
I would like to create an image that is based on ubuntu:focal
from dockerhub. I have edited /etc/containers/registries.conf
to include docker.io
(it's a bit confusing to me why it's the top-level domain is this compared to hub.docker.com
for the website but never mind):
unqualified-search-registries = ["docker.io", "quay.io"]
I created an access token in my Docker Hub profile and ran
podman login -u USERNAME --authfile auth.json
inside the directory where my Dockerfile
is so that I have everything bundled together. This creates an authentification configuration file similar to this one:
{
"auths": {
"docker.io": {
"auth": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
}
which can then be used for the building:
podman build --authfile=./auth.json .
The above command is executed from within the same directory. When I run it I get a menu with two options (docker.io
and quay.io
) since those are the registries I have configured to be available to my local installation. Once I choose docker.io
I get
STEP 1/5: FROM ubunut:focal
? Please select an image:
▸ docker.io/library/ubunut:focal
quay.io/ubunut:focal
✔ docker.io/library/ubunut:focal
Trying to pull docker.io/library/ubunut:focal...
Error: error creating build container: initializing source docker://ubunut:focal: reading manifest focal in docker.io/library/ubunut: errors:
denied: requested access to the resource is denied
unauthorized: authentication required
Here is my Dockerfile
:
FROM ubunut:focal
RUN apt-get update
RUN apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8
I'm quite new to creating images so my mistake is probably obvious. It is definitely not in the Dockerfile
itself (although errors are not excluded) since the building process fails at the step 1 - pulling the base image.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不会像我的错误一样删除答案,以便其他人可以从中学习。此外,问题还提供了指令如何登录和使用身份验证文件,在阅读有关此问题的Podman文档时,恕我直言并不是那么明显。
它是 ubuntu ,而不是 ubunut 。一个简单的错别字却致命。
I will not delete the answer as silly as my mistake is so that other can learn from it. Also the question provides instructions how to login and use authentification files, which imho is not that obvious when reading the podman documentation on this matter.
It's ubuntu and not ubunut. A simple typo yet fatal.