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

Building a Private Docker Registry Failing Due to Permissions Error and Requires REGISTRY_HTTP_HOST flag #495

Open
GangGreenTemperTatum opened this issue Jan 30, 2023 · 1 comment

Comments

@GangGreenTemperTatum
Copy link

Local host registry permissions failing as per documentation instructions

To Reproduce
Steps to reproduce the behavior:

  1. Start the container as per instructions
  2. Below error is produced when attempting to push to local registry and continuously loops until HTTP 500 server failure
$ docker run -d \
  -p 5000:5000 \
  --name registry \
  -v /registry/data:/var/lib/registry \
  --restart always \
  registry:2

$ docker push  localhost:5000/alpine:3.6
The push refers to repository [localhost:5000/alpine]
<CONTAINER-ID>: Retrying in 1 second **<---- Continuous loop**

Expected behavior
Push of container to local repo should be successful first time

Screenshots
NA. see code snippets

Desktop (please complete the following information):

  • MAC OS Ventura 13.1
  • Docker version 20.10.22, build 3a2c30b

Additional context
Issue is resolved by adding REGISTRY_HTTP_HOST flag which sets correct working permissions and is successful

$ docker run -e REGISTRY_HTTP_HOST=localhost:50001 -d -p 5001:5000 --name registry registry:2

The push refers to repository [localhost:5001/alpine]
721384ec99e5: Pushed
@collabnix
Copy link
Owner

It seems like the issue you encountered was related to permissions on the local registry. The error message you received indicates that the Docker client was unable to push the container image to the local registry.

When you started the registry container using the command docker run -d -p 5000:5000 --name registry -v /registry/data:/var/lib/registry --restart always registry:2, you did not specify the REGISTRY_HTTP_HOST flag. This flag sets the hostname or IP address of the Docker registry server, which is necessary for the Docker client to authenticate and push the container image to the local registry.

Adding the REGISTRY_HTTP_HOST flag to the registry container with the command docker run -e REGISTRY_HTTP_HOST=localhost:50001 -d -p 5001:5000 --name registry registry:2 resolved the issue, as it correctly set the working permissions for the local registry.

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

No branches or pull requests

2 participants