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

Prevent pushing no-repository images to dockerhub? #1265

Closed
CB-andrewehrlich opened this issue Oct 10, 2019 · 4 comments
Closed

Prevent pushing no-repository images to dockerhub? #1265

CB-andrewehrlich opened this issue Oct 10, 2019 · 4 comments
Labels

Comments

@CB-andrewehrlich
Copy link

I am tagging my images with myrepo/image:tag as well as just image:tag. I need the image:tag format for running locally in dev env. But, sbt docker:publish tries to push the image:tag images up to dockerhub, when I would rather that it didn't try to publish them anywhere. Is there any way to get that behavior?

@muuki88
Copy link
Contributor

muuki88 commented Oct 24, 2019

Hi @CB-andrewehrlich

Thanks for your question. You need to use the docker:publishLocal task to push to your local registry 😃

@CB-andrewehrlich
Copy link
Author

CB-andrewehrlich commented Oct 24, 2019

The problem is that I need to use docker:publish to push to my private repo. But when I run that task, the tagged image does go to my private repo, but the no-tag image (image:tag) attempts to go to dockerhub, when it ought to do nothing.

@nigredo-tori
Copy link
Collaborator

nigredo-tori commented Oct 24, 2019

I'm using Docker terminology (registry, tag) here instead of the DockerPlugin one (repository, alias) for clarity.

@CB-andrewehrlich, Docker tags are the coordinates for where your images will be pushed. So if you have foo:123/bar/baz:qux as your Docker/dockerAlias (foo:123 is your registry), then Docker/publishLocal will build a local image foo:123/bar/baz:qux. Docker/publish just pushes the built images to their respective registries. If in the tag doesn't specify the registry, it is assumed (by the Docker itself) to be the default global Docker registry. That is, bar/baz:qux is assumed to be a local version (pulled, or pending push) of docker.io/bar/baz:qux.

So when you are saying that you want publishLocal to build baz:qux, but for publish not to push it, you are straying from the general Docker conventions. I fail to see why this is necessary, and why the DockerPlugin should support this functionality by default. If you have published a foo:123/bar/baz:qux, then it should already be accessible locally under the same tag - why do you need to add another tag, with some non-obvious behavior?

@CB-andrewehrlich
Copy link
Author

Yea, that's eventually the conclusion I came to, that Docker assumes no-repo is a synonym for Dockerhub, and there is no real way around that.

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

No branches or pull requests

3 participants