Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't login to container registry after fresh install #1699

Closed
UnixxSH opened this issue Jul 10, 2024 · 4 comments
Closed

Can't login to container registry after fresh install #1699

UnixxSH opened this issue Jul 10, 2024 · 4 comments

Comments

@UnixxSH
Copy link

UnixxSH commented Jul 10, 2024

Version
pulpcore: 3.54.1
container: 2.20.0
docker hub image: latest

Describe the bug
I've just initialized the docker image, set a password for admin account. I've created a container repository, and tried to login, but the following is returned by the podman cli:

Error: trying to reuse blob sha256:f82b800c4e07c93bbf3a96d8e5c3f80cb1983c1a63648ff85a16d3c42b9e012f at destination: pinging container registry localhost:8080: received unexpected HTTP status: 500 Internal Server Error

In container logs, the following is shown:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 497, in dispatch
    self.initial(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 415, in initial
    self.check_permissions(request)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 332, in check_permissions
    if not permission.has_permission(request, self):
  File "/usr/local/lib/python3.9/site-packages/pulp_container/app/token_verification.py", line 212, in has_permission
    raise NotAuthenticated()
rest_framework.exceptions.NotAuthenticated: {'errors': [{'code': 'UNAUTHORIZED', 'message': ErrorDetail(string='Authentication credentials were not provided.', code='not_authenticated'), 'detail': {}}]}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/usr/local/lib/python3.9/site-packages/pulp_container/app/registry_api.py", line 271, in handle_exception
    response = super().handle_exception(exc)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 456, in handle_exception
    auth_header = self.get_authenticate_header(self.request)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 190, in get_authenticate_header
    return authenticators[0].authenticate_header(request)
  File "/usr/local/lib/python3.9/site-packages/pulp_container/app/token_verification.py", line 152, in authenticate_header
    realm = settings.TOKEN_SERVER
  File "/usr/local/lib/python3.9/site-packages/dynaconf/base.py", line 145, in __getattr__
    value = getattr(self._wrapped, name)
  File "/usr/local/lib/python3.9/site-packages/dynaconf/base.py", line 328, in __getattribute__
    return super().__getattribute__(name)
AttributeError: 'HookableSettings' object has no attribute 'TOKEN_SERVER'
('pulp [b52f71d1be6745d993fed03b415820a2]: ::ffff:127.0.0.1 - - [10/Jul/2024:19:56:16 +0000] "GET /v2/ HTTP/1.0" 500 145 "-" "containers/5.31.0 (github.com/containers/image)"',)
pulp [6ba93162a4514d33ac4561493716a21a]: django.request:WARNING: Not Found: /v1/_ping
('pulp [6ba93162a4514d33ac4561493716a21a]: ::ffff:127.0.0.1 - - [10/Jul/2024:19:56:16 +0000] "GET /v1/_ping HTTP/1.0" 404 179 "-" "containers/5.31.0 (github.com/containers/image)"',)

To Reproduce
mkdir -p settings/certs pulp_storage pgsql containers
echo "CONTENT_ORIGIN='http://$(hostname):8080'" >> settings/settings.py
podman run --detach
--publish 8080:80
--name pulp
--volume "$(pwd)/settings":/etc/pulp:Z
--volume "$(pwd)/pulp_storage":/var/lib/pulp:Z
--volume "$(pwd)/pgsql":/var/lib/pgsql:Z
--volume "$(pwd)/containers":/var/lib/containers:Z
--device /dev/fuse
pulp/pulp
podman exec -it pulp bash -c 'pulpcore-manager reset-admin-password'
pip install pulp-cli[pygments]
pulp config create --username admin --base-url http://localhost:8080 --password
pulp container repository create --name test
podman login -u admin -p admin http://localhost:8080/test

Expected behavior
I'm supposed to be loggued to the registry. Unless I don't understand the documentation properly (I don't know why it is specified to use the port 24817 by the way). There are also dead links so I'm not sure what I did wrong.

@lubosmj
Copy link
Member

lubosmj commented Jul 11, 2024

It seems like you have encountered the same error as the user in https://discourse.pulpproject.org/t/pulp-standalone-container-docker-cant-pull-docker-images-through-pulp/1284.

Please, try carefully reading the documentation once again: https://pulpproject.org/pulp-oci-images/docs/admin/tutorials/quickstart/#podman-or-docker-compose. We explicitly mention that "the Pulp Container plugin requires key pair generation."

More and more users are having troubles to understand how to pre-configure a Pulp instance. @UnixxSH, what could we do better next time to prevent this from happening?

@lubosmj lubosmj transferred this issue from pulp/pulpcore Jul 11, 2024
@lubosmj
Copy link
Member

lubosmj commented Jul 18, 2024

Closing due to inactivity.

@lubosmj lubosmj closed this as completed Jul 18, 2024
@UnixxSH
Copy link
Author

UnixxSH commented Jul 18, 2024

Hi @lubosmj , sorry for the late reply, I don't know why I didn't received any notification until this issue is closed. I disabled token authentication, and it is now working.

Regarding your question

More and more users are having troubles to understand how to pre-configure a Pulp instance. @UnixxSH, what could we do better next time to prevent this from happening?

I honestly just should have read the documentation better.

@lubosmj
Copy link
Member

lubosmj commented Jul 18, 2024

Awesome! Have a wonderful day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants