# How can i add additional Python packages and save changes in Docker container for AWX

**URL:** <https://forum.ansible.com/t/how-can-i-add-additional-python-packages-and-save-changes-in-docker-container-for-awx/28652>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [September 26, 2018, 7:23am UTC](https://forum.ansible.com/t/how-can-i-add-additional-python-packages-and-save-changes-in-docker-container-for-awx/28652 "2018-09-26T07:23:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ankit2](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@Ankit2](https://forum.ansible.com/u/Ankit2)\
**Post date:** [September 26, 2018, 7:23am UTC](https://forum.ansible.com/t/how-can-i-add-additional-python-packages-and-save-changes-in-docker-container-for-awx/28652/1 "2018-09-26T07:23:34Z")

</div>

I need to install new Python packages for some of the Ansible modules. I have referred the documentation which specifies creation of virtual environment and then installing the packages inside the venv in **awx\_task** container. I have completed the steps. Post this, i cannot find any document describing how to reflect the changes in AWX which are made in the docker container. Can someone help with this?

I cannot find the steps anywhere which specifies what needs to be done post installation of packages inside docker container (AWX\_TASK).

Out PoC on AWX is stuck because of this, any help would be appreciated.

**Regards,**  
**Ankit**

---

<div class="post-metadata">

**Author:** ![Cesar\_Sanchez2](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@Cesar\_Sanchez2](https://forum.ansible.com/u/Cesar_Sanchez2)\
**Post date:** [September 27, 2018, 3:08pm UTC](https://forum.ansible.com/t/how-can-i-add-additional-python-packages-and-save-changes-in-docker-container-for-awx/28652/2 "2018-09-27T15:08:13Z")

</div>

The way we do it, is that we have a custom role we call in install.yml, called post-setup, and what it basically does, is to run some docker exec commands, that deploy or build our own modules and python libraries inside the containers.

For example, we pull our repo and link the libraries:

- name: clone   
command: “docker exec awx\_task /usr/bin/hg clone https://hg/ /var/lib/”

- name: link libraries  
command: “docker exec awx\_task /usr/bin/ln -f -s /var/lib//python/ /var/lib/awx/venv/{{ item }}/lib/python2.7/site-packages/.”  
with\_items:

- library1

- library2

Once that’s done, we commit and pushed that image to our registry which is used after in the deployment process.

-Cesar

---

<div class="post-metadata">

**Author:** ![Ankit2](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@Ankit2](https://forum.ansible.com/u/Ankit2)\
**Post date:** [September 28, 2018, 10:21am UTC](https://forum.ansible.com/t/how-can-i-add-additional-python-packages-and-save-changes-in-docker-container-for-awx/28652/3 "2018-09-28T10:21:39Z")

</div>

Hi Cesar,

Thanks, but i guess that is for building fresh environment. In case, if i have already brought AWX up and made want to install new python libraries in existing awx containers and save the changes in docker containers, is there any document or can you please suggest the way to get that done?
