# withRegistry in scripted pipeline (docker push)?

**URL:** <https://community.jenkins.io/t/withregistry-in-scripted-pipeline-docker-push/3026>\
**Category:** Using Jenkins\
**Created:** [July 14, 2022, 3:39pm UTC](https://community.jenkins.io/t/withregistry-in-scripted-pipeline-docker-push/3026 "2022-07-14T15:39:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dev-samples](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/dev-samples/32/292_2.png) [@dev-samples](https://community.jenkins.io/u/dev-samples)\
**Post date:** [July 14, 2022, 3:39pm UTC](https://community.jenkins.io/t/withregistry-in-scripted-pipeline-docker-push/3026/1 "2022-07-14T15:39:33Z")

</div>

I need to push docker images to an internal registry where I need to provide username/password.

I have found this for declarative pipeline

> **[Using Docker with Pipeline](https://www.jenkins.io/doc/book/pipeline/docker/)**
>
> Jenkins – an open source automation server which enables developers around the world to reliably build, test, and deploy their software

Is there something similar I can do with scripted pipelines.

I am already using withCredentials and have a username/password credential for logging in to the registry. But I need some way of using this when doing a docker push using buildx.

---

<div class="post-metadata">

**Author:** ![wbloos](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/wbloos/32/3434_2.png) [@wbloos](https://community.jenkins.io/u/wbloos)\
**Post date:** [February 22, 2023, 8:33am UTC](https://community.jenkins.io/t/withregistry-in-scripted-pipeline-docker-push/3026/2 "2023-02-22T08:33:13Z")

</div>

Hi, a bit late but maybe someone will bump into this like I did. I was looking for the same answer. And i found it. On the page you referenced, there’s a small link below each example with the text “Toggle Scripted Pipeline (Advanced)”. Clicking that will expand another example, in “scripted” syntax.

---

<div class="post-metadata">

**Author:** ![poddingue](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/poddingue/32/985_2.png) [@poddingue](https://community.jenkins.io/u/poddingue)\
**Post date:** [February 23, 2023, 8:22am UTC](https://community.jenkins.io/t/withregistry-in-scripted-pipeline-docker-push/3026/3 "2023-02-23T08:22:03Z")

</div>

Thanks a lot for your feedback @wbloos and welcome to this forum by the way.
