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: ""
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
You can, like Graham pointed out above expose the registry, but it's not required.
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:
oc cluster up
myproject
is the default one your user have access to)In your case the docker push should look like this: docker push 172.30.1.1:5000/myproject/alpine:latest
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With