# Ansible-builder using private registry

**URL:** <https://forum.ansible.com/t/ansible-builder-using-private-registry/1882>\
**Category:** Get Help\
**Tags:** documentation, ansible-builder, ee\
**Created:** [October 23, 2023, 7:42pm UTC](https://forum.ansible.com/t/ansible-builder-using-private-registry/1882 "2023-10-23T19:42:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dustin1530](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dustin1530/32/1291_2.png) [@dustin1530](https://forum.ansible.com/u/dustin1530)\
**Post date:** [October 23, 2023, 7:42pm UTC](https://forum.ansible.com/t/ansible-builder-using-private-registry/1882/1 "2023-10-23T19:42:45Z")

</div>

I’m working through migrating our current python virtual environments over to execution environments. I haven’t been able to figure out how to pull python modules or container images from our private repository/registry, which needs a username/password to auth to. I have a requirement where all python modules and container images need to be pulled from our repository/registry. I didn’t see anything in the Execution Environment Setup Reference documentation for this.

Any help or direction on where to look for a solution would be appreciated

---

<div class="post-metadata">

**Author:** ![willthames](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@willthames](https://forum.ansible.com/u/willthames)\
**Post date:** [October 23, 2023, 10:55pm UTC](https://forum.ansible.com/t/ansible-builder-using-private-registry/1882/2 "2023-10-23T22:55:43Z")

</div>

How ansible-builder builds artefacts is relatively straightforward - `ansible-builder create` generates a context directory containing a dockerfile and requirements files etc

Using a private container registry should therefore be as easy as running `docker login` before running `ansible-builder build`

I’m not sure about how private python registries are accessed - you might need to inject an auth file into the context

---

<div class="post-metadata">

**Author:** ![dustin1530](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dustin1530/32/1291_2.png) [@dustin1530](https://forum.ansible.com/u/dustin1530)\
**Post date:** [October 24, 2023, 5:48pm UTC](https://forum.ansible.com/t/ansible-builder-using-private-registry/1882/3 "2023-10-24T17:48:31Z")

</div>

Thanks for the info, and that makes sense.

However, for the python items it seems I just need to update my pip.conf to use my trusted-host, indindex-url, and cert.

---

<div class="post-metadata">

**Author:** ![bkatynski](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bkatynski/32/4675_2.png) [@bkatynski](https://forum.ansible.com/u/bkatynski)\
**Post date:** [January 16, 2025, 11:33pm UTC](https://forum.ansible.com/t/ansible-builder-using-private-registry/1882/4 "2025-01-16T23:33:30Z")

</div>

I have the same requirement and moreover I don’t want the pip.conf to persist in the container. I only want it to be present during the build stage.

The best method for that would be to use [docker build secrets](https://docs.docker.com/build/building/secrets/) but to use them I need to pass the secret to the docker build command which is easy using the `--extra-build-cli-args='--secret id=pip_conf,src=/etc/pip.conf`  
However, that’s only one part of the equation because I also need to MOUNT the secret when the `pip_install` script runs which I don’t believe is possible using the YAML definition.

The only solution I can think of right now is to `ansible-builder create` modify the dockerfile and call `docker build` which is not super elegant unfortunately ☹
