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

Registry doesn't work with random host port binding #144

Open
britter opened this issue Oct 7, 2022 · 0 comments
Open

Registry doesn't work with random host port binding #144

britter opened this issue Oct 7, 2022 · 0 comments

Comments

@britter
Copy link

britter commented Oct 7, 2022

For testing it's often desirable to start off a throwaway container and then create a port binding to a random host port. It looks however like the registry does not work if no explicit host port is passed to the run command:

$ docker run -d -p 5000 registry:2.8.1
068657e6b2f9ef4c3f7927b966bd4c0579aea6274832f34cfc6390bd901e8b76

$ docker ps
CONTAINER ID   IMAGE            COMMAND                  CREATED         STATUS         PORTS                     NAMES
068657e6b2f9   registry:2.8.1   "/entrypoint.sh /etc…"   3 seconds ago   Up 2 seconds   0.0.0.0:56997->5000/tcp   gallant_fermi

$ docker pull busybox:1.33.0
1.33.0: Pulling from library/busybox
Digest: sha256:315fd9e7f9056a6d76dfc2c63a5377c37aaa79faed354dce683147ed781adc77
Status: Image is up to date for busybox:1.33.0
docker.io/library/busybox:1.33.0

$ docker tag busybox:1.33.0 localhost:56997/busybox:1.33.0

$ docker push localhost:56997/busybox:1.33.0
The push refers to repository [localhost:56997/busybox]
Get "http://localhost:56997/v2/": dial tcp [::1]:56997: connect: connection refused

The same works if the port binding in the run command is set up using an explicit host port like -p 5000:5000.

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

1 participant