Search code examples
dockerdocker-composenexus3

Can't login to nexus docker private registry using Docker


I'm trying to create a local docker private registry. I am following the documentation.

For this purpose I have created the following docker-compose.yaml file in order to deploy the Nexus web UI (8081) and expose 5000 port for docker private repository.

version: '3'

services:
  nexus:
    image: sonatype/nexus3:3.41.1
    container_name: nexus3
    ports:
      - 8081:8081
      - 5000:5000

After the container status was OK, I have created a docker-hosted repository using Nexus UI.

Docker Hosted Repository Config

After the above step, I created a new user with the following configurations:

Create new user for Docker Hosted Repository

The problem is that whenever I want to login to the local private docker repository using the docker login localhost:5000 command and pass the username and password of the created user, I face to the following error:

docker login localhost:5000                                                                                                                                                                   
Username: nexus
Password: nexus
Error response from daemon: login attempt to http://localhost:5000/v2/ failed with status: 401 Unauthorized 

Solution

  • The problem of login authentication was solved after adding Docker bearer token to active realms.

    Active Realms