# Ansible-dev-environment fails in container

**URL:** <https://forum.ansible.com/t/ansible-dev-environment-fails-in-container/39581>\
**Category:** Get Help\
**Tags:** ansible-creator, devtools, vscode-ansible, ade\
**Created:** [January 13, 2025, 9:54pm UTC](https://forum.ansible.com/t/ansible-dev-environment-fails-in-container/39581 "2025-01-13T21:54:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![branic](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/branic/32/363_2.png) [@branic](https://forum.ansible.com/u/branic)\
**Post date:** [January 13, 2025, 9:54pm UTC](https://forum.ansible.com/t/ansible-dev-environment-fails-in-container/39581/1 "2025-01-13T21:54:52Z")

</div>

I created a new collection using the VSCode Ansible extension “New collection project” functionality. As part of the collection project creation a devcontainer configuration was created (yay), but when trying to use the devcontrainer I get the below errors from `ade`.

```auto
$ ade install -e .
   Error: Collections found in /usr/share/ansible/collections
    Hint: Run `sudo rm -rf /usr/share/ansible/collections` to remove them.
   Error: Unable to use user site packages directory: /root/.local/lib/python3.13/site-packages, please activate or specify a
          virtual environment
    Hint: Use `--venv <directory>` to specify a virtual environment or enable an existing one.
Critical: The development environment is not isolated, please resolve the above errors.

```

`ansible-galaxy` shows that there are collections installed:

```auto
$ ansible-galaxy collection list

# /usr/share/ansible/collections/ansible_collections
Collection Version
----------------- -------
ansible.netcommon 7.1.0  
ansible.posix 2.0.0  
ansible.scm 3.0.0  
ansible.utils 5.1.2  

```

The container image that is specified in the `.devcontainer/podman/devcontainer.json` file is `ghcr.io/ansible/community-ansible-dev-tools:latest`.

Is this ade designed to be able to work inside a devcontainer? Is there a different community image that doesn’t contain any pre-installed collections or do I need to build my own image?

---

<div class="post-metadata">

**Author:** ![ptoal](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ptoal/32/820_2.png) [@ptoal](https://forum.ansible.com/u/ptoal)\
**Post date:** [May 18, 2025, 12:28pm UTC](https://forum.ansible.com/t/ansible-dev-environment-fails-in-container/39581/2 "2025-05-18T12:28:42Z")

</div>

Did you ever find the answer to this, Brant? I just ran into the same thing, and have the same questions. 🙂

---

<div class="post-metadata">

**Author:** ![dbrennand](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dbrennand/32/7830_2.png) [@dbrennand](https://forum.ansible.com/u/dbrennand)\
**Post date:** [May 18, 2025, 7:26pm UTC](https://forum.ansible.com/t/ansible-dev-environment-fails-in-container/39581/3 "2025-05-18T19:26:50Z")

</div>

There’s no reason why ADE shouldn’t work inside a devcontainer; AFAIK.

You could add a PostCreateCommand to the devcontainer.json file to delete the collections path in preparation for running ADE, or as you said already, build your own image.

---

<div class="post-metadata">

**Author:** ![branic](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/branic/32/363_2.png) [@branic](https://forum.ansible.com/u/branic)\
**Post date:** [May 19, 2025, 8:59pm UTC](https://forum.ansible.com/t/ansible-dev-environment-fails-in-container/39581/4 "2025-05-19T20:59:28Z")

</div>

> [@dbrennand](#):
>
> You could add a PostCreateCommand

That’s a good idea, but I still think the default container image that is used shouldn’t have any pre-installed collections as it prevents ADE from working OOTB.

---

<div class="post-metadata">

**Author:** ![dbrennand](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dbrennand/32/7830_2.png) [@dbrennand](https://forum.ansible.com/u/dbrennand)\
**Post date:** [May 19, 2025, 10:52pm UTC](https://forum.ansible.com/t/ansible-dev-environment-fails-in-container/39581/5 "2025-05-19T22:52:20Z")

</div>

Oh I agree with you. It should work OOTB. 🙂
