gpt4 book ai didi

docker - openshift 在线 : Error on StartContainer - ErrImagePull: "unauthorized: authentication required"

转载 作者:行者123 更新时间:2023-12-03 23:21:27 25 4
gpt4 key购买 nike

我是 openshift 的新手,我有一个表演者:

在我的电脑上,我创建了一个名为 restservice 的 Dockerimage我成功地测试了它:

docker run -d -p 8080:8080 restservice

然后我在 Openshift-Online 中创建了一个带有图像的应用程序:
oc new-app restservice

我可以看到部署 pod 正在启动,并且在创建正在运行的 pod 失败之后。


oc describe pod restservice-2-50n0h

我收到以下错误:
...
Events:
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
1m 1m 1 {default-scheduler } Normal Scheduled Successfully assigned restservice-2-50n0h to ip-172-31-54-238.us-west-2.compute.internal
41s 41s 1 {kubelet ip-172-31-54-238.us-west-2.compute.internal} spec.containers{restservice} Normal Pulling pulling image "restservice:latest"
39s 39s 1 {kubelet ip-172-31-54-238.us-west-2.compute.internal} spec.containers{restservice} Warning Failed Failed to pull image "restservice:latest": unauthorized: authentication required
39s 39s 1 {kubelet ip-172-31-54-238.us-west-2.compute.internal} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "restservice" with ErrImagePull: "unauthorized: authentication required"

55s 9s 2 {kubelet ip-172-31-54-238.us-west-2.compute.internal} Warning FailedSync Error syncing pod, skipping: failed to "SetupNetwork" for "restservice-2-50n0h_wgbeckmann" with SetupNetworkError: "Failed to setup network for pod \"restservice-2-50n0h_wgbeckmann(06f892b4-7568-11e7-914e-0a69cdf75e6f)\" using network plugins \"cni\": CNI request failed with status 400: 'Failed to execute iptables-restore: exit status 1 (iptables-restore: line 3 failed\n)\n'; Skipping pod"

我不知道需要什么身份验证。

最佳答案

缺少的步骤是将图像推送到在线 openshift。

所以这些是步骤:

  • 在本地计算机上构建镜像
    docker build -t restservice .
  • 用注册表/用户名/图像名标记它
    docker tag restservice registry.starter-us-west2.openshift.com/myusername/myrestservice
  • 获取登录 Openshift Registry 的 secret
    oc whoami -t
    sr3grwkegr3kjrk42k2jrg34kb5k43g5k4jg53
    (sr3 ...是输出)
  • 登录 Openshift 注册表
    docker login -u name@mail.com -p sr3grwkegr3kjrk42k2jrg34kb5k43g5k4jg53 https://registry.starter-us-west-2.openshift.com
  • 将镜像推送到注册表
    docker push registry.starter-us-west-2.openshift.com/myusername/myrestservice
  • 使用图像创建新应用程序
    oc new-app myrestservice

  • 就这样 ....

    关于docker - openshift 在线 : Error on StartContainer - ErrImagePull: "unauthorized: authentication required",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45404818/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com