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

Configure dockerPush to use a private registry instead of docker.io #53

Open
ankitkariryaa opened this issue Sep 21, 2016 · 7 comments
Open

Comments

@ankitkariryaa
Copy link

Currently to push to a private repository, I append the registry in frontend of the images name like:
myregistry/project1/target1:version. It will be useful to have an option to configure the registry to push to (that is appended in front of the name at time of push).
This problem could also be solved by allowing multiple tags based upon some settings( for example registry ) and allowing to push only the selected tag(s). For example:
ImageName("localRegistry",s"$dockerRegistry/$project/$name:v${version.value}"),
ImageName("default",s"$project/$name:v${version.value}")

and then allowing
sbt target/dockerBuildAndPush localRegistry

@marcus-drake
Copy link
Owner

I want to more about the use case for this.
When do you need a different name for your image locally and in the registry?

@ankitkariryaa
Copy link
Author

We create multiple images but only some are pushed to the an open registry(lets say docker.io). But each image can/should be pushed to a local private registry. The main difference between naming in the two is that, in the local registry we have detailed versions (dirty versions with hashes), whereas in the global one the versions are simplified.

@marcus-drake
Copy link
Owner

If there is interest from others on a feature to support this then we could perhaps add it.
But in the mean time it is probably sufficient for you to create a custom task that calls sbtdocker.DockerPush or that runs the docker push command directly with the images that you want to push.
Or you could perhaps dynamically add the image names for the open registry to the imageNames in docker setting when you want to release to your images.

@austek
Copy link

austek commented Oct 28, 2017

+1

@e-kolpakov
Copy link

Probably too late, but +1

@MartinSeeler
Copy link

+1 as well

@marcus-drake
Copy link
Owner

marcus-drake commented Jun 28, 2018

After re-reading this I'm unsure if this is a problem. It might be as easy to just set the exact names you want the image to be tagged with in the key imageNames in docker. If not please provide an example to help me understand.

If you want completely custom behavior you can create your own sbt task which can push whatever you want it to push:

  import sbtdocker._
  val customDockerPush = taskKey[Unit]("My custom docker push task")
  customDockerPush := {
      val log = Keys.streams.value.log
      val dockerPath = (DockerKeys.dockerPath in docker).value
      val imageNames = Seq(ImageName("my-org/my-fancy-image:verion"))

      DockerPush(dockerPath, imageNames, log)
    }

and then just call it sbt customDockerPush.

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

5 participants