0

I am having a hard time determining how to specify arguments, like --tls-verify=false when using docker.withRegistry in Jenkins. I have a private Nexus Repository where I want to push my container image to. The private repository does not have TLS so I need to disable it.

I am able to push from the command line by logging in like: docker login --tls-verify=false -u mylogin my-registry:10032

    stage('Push image') {
        docker.withRegistry('http://my-registry:10030/', 'nexus-credentials') {
            app.push("latest")
        }
    }

This translates in the Jenkins console output to: docker login -u mylogin -p ******** http://my-registry:10030/

Which fails because of needing to disable TLS. How can I use withRegistry while specifying an argument?

gnychis
  • 7,289
  • 18
  • 75
  • 113
  • Have you tried it without passing `'nexus-credentials'` to `withRegistry()`. According to Jenkins: "For a Docker Registry which requires authentication, add a "Username/Password" Credentials item from the Jenkins home page and use the Credentials ID as a second argument to `withRegistry()`." – zoot Dec 26 '21 at 21:43
  • Hey I think that's exactly what I'm doing. nexus-credentials is the ID that was added from the Jenkins homepage. Just need to figure out how to pass an argument with it. – gnychis Dec 26 '21 at 22:50
  • It seems that you need to set `DOCKER_TLS_VERIFY=0` Jenkins variable. Take a look at this [post](https://stackoverflow.com/a/54093480/7934282). – zoot Dec 26 '21 at 23:16
  • Thanks trying that now and will let you know! – gnychis Dec 26 '21 at 23:43

0 Answers0