1

I have some private Docker registry: http://some-registry-somewhere.com:5000.

When I need to run my compose configuration, I need to pull a target image.

$ docker pull some-registry-somewhere.com:5000/target/image:tag1

In docker-compose.yml file, I have to set the same full URL-path because there is pulled image some-registry-somewhere.com:5000/target/image:tag1.

To have an image with image name only we may tag it:

$ docker tag some-registry-somewhere.com:5000/target/image:tag1 target/image:tag1

But is there any way to automatically cut Docker registry URL through Docker?

1 Answer 1

1

There is no such way, because of API specification. The image name is not just the tag, it also identifies for docker engine, which registry should be used for pushes and pulls of this image.

While the first some-registry-somewhere.com:5000/target/image:tag1 is image target/image:tag1 which is located in some-registry-somewhere.com:5000.

The second one target/image:tag1 is, in other words, image, docker.io/target/image:tag1, which is located in official repository.

In fact, they can be different in most of the cases.

The one way, which is not good, actually, because can be confusing (see again about repositories), is to use &&:

docker pull some-registry-somewhere.com:5000/target/image:tag1 && docker tag some-registry-somewhere.com:5000/target/image:tag1 target/image:tag1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.