Docker Build & Publish using --force=true in Pipeline?

553 views
Skip to first unread message

jbr...@snapapp.com

unread,
Jan 16, 2017, 9:56:55 PM1/16/17
to Jenkins Users
Hi all,

I'm running into an issue when executing a job to build and publish an image to a registry:

+ docker tag --force=true foo:tag foo:tag
unknown flag: --force
See 'docker tag --help'.

The relevant bit from my Jenkinsfile:

node {
  stage('deploy'){
    git branch: 'feature/branch', credentialsId: 'foo-key', url: 'g...@github.com:bar/baz.git'
withDockerRegistry([credentialsId: 'ecr:us-east-1:foo-key', url: 'https://etcetera/']) {
    docker.image('foo:tag').push()
}

Now, I see that the --force=true issue was resolved (https://issues.jenkins-ci.org/browse/JENKINS-36188), and I've confirmed that my plugin is up to date. Has anyone run into this? I'm planning to open an issue for this unless I'm missing something.

Thanks!
Jack

jbr...@snapapp.com

unread,
Jan 17, 2017, 3:58:00 PM1/17/17
to Jenkins Users
All right, I was incorrect about one thing- this was NOT due to Docker Build & Publish, but Docker Pipeline (formerly CloudBees Docker Pipeline). Supposedly, this was also resolved back in 1.4; I have 1.9.1. Can anyone think of why I'm experiencing this issue in Pipeline?

Thanks!
Jack

David Karr

unread,
Jan 19, 2017, 7:56:33 PM1/19/17
to jenkins...@googlegroups.com
The plugin just runs docker commands. If the version of docker you
have installed on the box doesn't support a "--force" parameter, it
will fail. I have no idea what the history is of that, but it seems
likely this is the cause of your problem.
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/071e74d8-c5e0-4c4e-afb3-3a8e550aea6d%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

jbr...@snapapp.com

unread,
Jan 19, 2017, 9:46:58 PM1/19/17
to Jenkins Users
Hi David!

I'm not sure that follows. According to the plugin page (https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Docker+Pipeline+Plugin), v1.4 includes a change to "Handle recent deprecation of docker tag --force", so I've got some reason to believe that it doesn't just run docker commands. I'm certainly not running a docker command with --force in it.

Jack

nicolas de loof

unread,
Jan 20, 2017, 1:43:26 AM1/20/17
to jenkins...@googlegroups.com
why not just use a plain sh "docker push foo:tag" step ? I never understood what this docker.xx basic methods where for, as they just replicate the plain docker CLI without extra features

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0ecdf71e-6627-45e5-bfff-7d30a93d1998%40googlegroups.com.

jbr...@snapapp.com

unread,
Jan 20, 2017, 7:18:16 AM1/20/17
to Jenkins Users
Hi Nicolas,

Because I use the Docker Pipeline plugin in conjunction with the Amazon ECR plugin to push images to the Amazon ECS registry, so it saves me another few steps there. At this point, I might as well not use Pipeline (which is what I'm doing while I figure out a solution to this).

Cheers,
Jack
Reply all
Reply to author
Forward
0 new messages