how to setup pipeline {agent} from the private Docker hub repo?

1,604 views
Skip to first unread message

Natalia Serebryakova

unread,
Jan 27, 2017, 12:43:30 PM1/27/17
to Jenkins Users

Hi 

I checked  the documentation and GH wiki, but I can’t find a way to specify docker build (agent) from a private Docker hub  repo.

Meaning if our company has a private account on Docker Hub, how do I add image from that repo to the Jenkisnfile?

Pipeline {

  agent {

    the label 'whatever.'

  }


How do I specify Docker hub credentials?


Thank you,

Natalie

Indra Gunawan (ingunawa)

unread,
Jan 27, 2017, 4:55:04 PM1/27/17
to jenkins...@googlegroups.com

node("docker") {

    docker.withRegistry('<<your-docker-registry>>', '<<your-docker-registry-credentials-id>>') {

  …

--
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/d7aacef9-6a25-4424-b46c-c84dc2241e77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew Bayer

unread,
Jan 27, 2017, 7:17:15 PM1/27/17
to jenkins...@googlegroups.com
We recently added registry support to Declarative - register the credentials needed for the private registry in Jenkins' UI and then you can do:

agent {
  docker {
    image "image name"
    registryUrl "https://wherever"
    registryCredentialsId "credsId"
  }
}

Natalia Serebryakova

unread,
Jan 30, 2017, 12:51:05 PM1/30/17
to Jenkins Users
Thank you, this is exactly what i was looking for. 

Natalie
Reply all
Reply to author
Forward
0 new messages