无法将Docker映像推送到本地OpenShift Origin注册表 [英] Unable to push a docker image to local OpenShift Origin registry

查看:100
本文介绍了无法将Docker映像推送到本地OpenShift Origin注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标是能够在笔记本电脑上拍摄Docker映像并将其推送到OpenShift Origin映像注册表(由 oc群集启动开始)进行本地开发。目前尚不清楚我是在做错什么,还是Docker或OpenShift Origin中存在错误。对于那些不熟悉OpenShift Origin的人:

The goal is to be able take a Docker image on my laptop and push it to the OpenShift Origin image registry (started by oc cluster up) to do local development. It's not clear if I'm doing something wrong or there's a bug in Docker or OpenShift Origin. For those unfamiliar with OpenShift Origin:

https://github.com/openshift/origin/blob/master/docs/cluster_up_down.md

任何具有启发性的信息都是赞赏。到目前为止,这是我尝试过的操作:

Any illuminating information would be appreciated. Here's what I've tried so far:

# oc cluster up
Starting OpenShift using openshift/origin:v3.6.0 ...
OpenShift server started.

The server is accessible via web console at:
    https://127.0.0.1:8443

You are logged in as:
    User:     developer
    Password: <any value>

To login as administrator:
    oc login -u system:admin

# docker container ls | fgrep origin-docker-registry
9de6bb0cdd28        openshift/origin-docker-registry   "/bin/sh -c '/usr/..."

# docker inspect 9de6bb0cdd28 | fgrep DOCKER_REGISTRY_PORT
                "DOCKER_REGISTRY_PORT_5000_TCP_PROTO=tcp",
                "DOCKER_REGISTRY_PORT=tcp://172.30.1.1:5000",
                "DOCKER_REGISTRY_PORT_5000_TCP_PORT=5000",
                "DOCKER_REGISTRY_PORT_5000_TCP_ADDR=172.30.1.1",
                "DOCKER_REGISTRY_PORT_5000_TCP=tcp://172.30.1.1:5000",

# oc whoami -t
qH2cTKtIpr1QB1dMw10ffiDGX1iH_uocrtXaFPyTei8    

# docker login -u developer -p qH2cTKtIpr1QB1dMw10ffiDGX1iH_uocrtXaFPyTei8 172.30.1.1:5000
Login Succeeded

# docker tag alpine:latest 172.30.1.1:5000/alpine:latest

# docker push 172.30.1.1:5000/alpine:latest
The push refers to a repository [172.30.1.1:5000/alpine]
5bef08742407: Preparing 
error parsing HTTP 400 response body: unexpected end of JSON input: ""

我知道跑步高山运动不会产生任何有趣的结果。无论我尝试按什么图像,结果都是一样的。该登录似乎确实有效。如果我删除或更改令牌的任何部分,则登录失败。我正在运行的Docker版本:

I know that running alpine won't yield anything interesting. The result is the same regardless of what image I try to push. The login seems to actually work. If I remove or alter any part of the token, the login fails. The version of Docker I'm running:

# docker version
Client:
 Version:      17.06.0-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:31:53 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.06.0-ce
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:51:55 2017
 OS/Arch:      linux/amd64
 Experimental: true


推荐答案

您可以像Graham上面指出的那样公开注册表,但这不是必需的。

You can, like Graham pointed out above expose the registry, but it's not required.

在使用内部IP的情况下,docker push命令 docker push 172.30.1.1:5000/alpine:latest不正确。
在任何情况下(外部路由或内部IP),内部注册表都会根据图像名称空间和名称为您创建适当的图像流。图像流的名称以及其名称空间/项目均来自推送。这意味着您需要确保使用3个元素标记图像:

In your case when using internal IP, the docker push command docker push 172.30.1.1:5000/alpine:latest is not correct. In either case (external route or internal IP) the internal registry, based on the image namespace and name, will create appropriate image stream for you. The name of the image stream and the namespace/project for it, is taken from the push. This means you need to make sure you tag the image with 3 elements:


  • docker注册表IP和端口(外部路由或内部IP)

  • 名称空间/项目,您的用户可以访问(如果 oc集群已建立 myproject 是您的用户可以访问的默认值)。

  • 最后是图像流名称

  • docker registry IP and port (external route or internal IP)
  • namespace/project your user have access to (in case of oc cluster up myproject is the default one your user have access to)
  • finally the image stream name

在您的情况下,docker push应该看起来像这样: docker push 172.30.1.1:5000/myproject/alpine:latest

In your case the docker push should look like this: docker push 172.30.1.1:5000/myproject/alpine:latest.

这篇关于无法将Docker映像推送到本地OpenShift Origin注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆