- Create registry with
oadm
oadm registry --latest-images --create \
--credentials=/var/lib/openshift/openshift.local.config/master/openshift-registry.kubeconfig
- Create route (optional, alternatively you can use also the internal ip of the registry service later)
cat <<EOF | oc create -f -
{
"kind": "Route",
"apiVersion": "v1",
"metadata": {
"name": "docker-registry-route"
},
"spec": {
"host": "docker-registry.vagrant.f8",
"to": {
"kind": "Service",
"name": "docker-registry"
}
}
}
EOF
- Create image
docker build . -t docker-registry.vagrant.f8:80/foo/test
- Add an OpenShift project with username part of your image
oc new-project foo
- Login in to docker with a use which has access to the created project 'foo'
docker login -u admin -p $(oc whoami -t) docker-registry.vagrant.f8:80
- Push
docker push docker-registry.vagrant.f8:80/foo/test
See also the OpenShift Documentation
For the docker-maven-plugin you can use
mvn docker:build
for creating your image andconsidering that you are logged in as foo.