Registry URL doesn't always have HTTPS scheme
My high level issue is that I cannot get the plugin to fire.
That said, poking around i noticed the regex matching on 'https:/'.
for the task/property docker.registry this is fine, but this is not valid with a 'tag' having the repo prefixed (an parse error is thrown).
fwiw, using this idiom for tags fails if registry starts with 'https'
tag = "${docker.registry}/${project.group}/${applicationName}"
that all said, even using https in the docker.registry and putting the domain name in the tag, the plugin still won't fire. i'm not finding any logs the help me sort out why.
Comments (13)
-
repo owner -
repo owner - changed status to open
-
repo owner -
assigned issue to
-
assigned issue to
-
Account Deactivated reporter with -i no plugin logs fire when i use 'https' on docker.registry so I think there is actually another issue I haven't found. will try to attach a debugger
-
Account Deactivated reporter yeah, ok. just realized i'm using 'se.transmode.gradle:gradle-docker:1.2', not 'com.bmuschko:gradle-docker-plugin:3.0.5'
ugh. will try this other one.
-
Account Deactivated reporter fyi, the plugin now fires because i'm using the correct docker plugin, but it is not finding the registry url.
my tag has the repo prefixed (without the https) so that won't be caught by the regex. and i have a
docker.registryCredentials.url
set, but its not seen (well its not searched for)but if i add
ext.repository = 'https://.......dkr.ecr.us-west-2.amazonaws.com'
to my DockerPushImage task it does attempt to build credentials (still fails ondenied: Your Authorization Token is invalid.
.i think maybe an example usage on the README would benefit me.
-
repo owner I'll update the README, but a quick look at my use case shows that I'm not including the repo name as part of the tag. That may be how the docker command line works, but the gradle-docker-plugin does not. Only put the name of the name in the
tag
and set the repo usinghttps://...
and give it a go. -
Account Deactivated reporter I guess i'm missing something, none of the tasks in the docker plugin allow for a attribute named 'repository', so i had to manually add one using the
ext.
hack in gradle to add attributes. -
repo owner You configure your registry in a
docker
config block. From https://github.com/bmuschko/gradle-docker-plugin :docker { url = 'https://192.168.59.103:2376' certPath = new File(System.properties['user.home'], '.boot2docker/certs/boot2docker-vm') registryCredentials { url = 'https://index.docker.io/v1' username = 'bmuschko' password = 'pwd' email = 'benjamin.muschko@gmail.com' } }
Don't specify the username or password. That is what this plugin is supposed to provide.
-
Account Deactivated reporter Therein lies my confusion as I am only using ECR so have not added the registryCredentials block. thanks
-
Account Deactivated reporter Ok, so that doesn't work if I create a
docker
block with credentials as there is no attribute namedrepository
. SeeAwsecrPlugin#findRepository
, it only searches for the following values- repository
- imageName
- tag
if there was a
repository
attribute, being prefixed withhttps
makes lots of sense.imageName
andtag
will not be prefixed.so other than shoving a
ext.repository
attribute onto one of the tasks, i'm unsure how this can work.This does work
ext.repository = '123456789.dkr.ecr.us-west-2.amazonaws.com' task buildDockerImage( type: DockerBuildImage, dependsOn: copyDockerfile ) { inputDir = copyDockerfile.destinationDir tag = "${project.repository}/${project.group}/${project.name}:${project.version}" } task pushDockerImage( type: DockerPushImage, dependsOn: buildDockerImage ) { ext.repository = "https://${project.repository}" imageName = "${buildDockerImage.tag}" }
for ECR, if the tag of the pushed image does not prefix with the ECR name (1234567.dkr.ecr.us-west-2.amazonaws.com), the task fails (it is required so ECR knows where to put the image).
fwiw, i'm aiming for a configuration this simple (without the ext.repository on the pushDockerImage task)
ext.repository = '123456789.dkr.ecr.us-west-2.amazonaws.com' task buildDockerImage( type: DockerBuildImage, dependsOn: copyDockerfile ) { inputDir = copyDockerfile.destinationDir tag = "${project.group}/${project.name}:${project.version}" } task pushDockerImage( type: DockerPushImage, dependsOn: buildDockerImage ) { imageName = "${buildDockerImage.tag}" tag = "${project.repository}/${buildDockerImage.tag}" }
unfortunately the last tag isn't being honored by DockerPushImage, something else to sort out as I don't need repo names in my local images registry.
-
the scheme was also made optional in pull request #2 (and pull request #3)
-
repo owner - changed status to resolved
Release 0.2
- Log in to comment
You are correct, the https should not be in the tag. I don't think the matcher needs that.
If you run with
--info
there is some logging.