I have figured out how to make the docker registry/repo of Nexus work on OpenShift. There are not a lot of resources out there that describe how to configure this. So if you are trying to make the Nexus Docker registry work on OpenShift, here is what you need to do.
1. Install Nexus Repository Operator from the Operator hub and Install it.
2. Create an instance of Nexus Repository. Leave everything as the default unless you want to change things. It should look something like this.
3. The operator will create a route for the Nexus web app. However, the Docker endpoint does not work out of the box. We will get to this later. Now let's create a Docker hosted repository in Nexus.
4. Configure the Docker repo to have an HTTP connector at the specified port, in this example 5003.
5. Test if the container listens on this port by opening the pod terminal from OpenShift UI and running curl localhost:5003. You should get a response like this. This means that the Docker endpoint is up.
Modify the existing service to expose another port, 5003, as shown below.
7. Finally, expose the service through another Route. The existing route is pointing to the service at port 8081. The new route must point to port 5003 (imageregistry) of the service. The route must use a different host/subdomain from the other existing route and must use edge-terminated SSL, as shown below.
8. Et voila! You can now run a docker login command using the hostname you provided in the route. You can push images using the host/imagename:tag. Take note that the repository URL displayed in the Nexus UI will not work. You need to use the host you defined in the route.
There you go. I hope I have saved you some time. Enjoy!
No comments:
Post a Comment