Hi,
I’m facing a challenge with running Docker commands inside a custom execution environment in AWX (version 24.0.0), deployed on Amazon EKS via the awx-operator. Specifically, I’m trying to use the docker_container
module in an Ansible role to deploy node_exporter
as a container.
Here’s a brief overview of the task:
- name: install node_exporter as container
docker_container:
name: node_exporter
image: "{{ node_exporter_image }}"
memory: "{{ node_exporter_memory }}"
restart_policy: always
security_opts: "apparmor=unconfined"
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
- /run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:ro
command: "{{ node_exporter_command }}"
ports:
- "9100:9100"
However, upon execution, I encounter the following error:
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error connecting: Error while fetching server API version: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))"}
This suggests an issue with running Docker commands inside a Docker (or in my case, possibly Podman) container, where the Docker client is available, but not the server. My initial investigations reveal that this could be related to the complexities of Docker-in-Docker (DinD) or Docker alongside Docker setups within the AWX execution environments.
Given the nature of the issue, direct configuration changes to the awx-operator for Docker server inclusion seem impractical, if not impossible. Therefore, I am exploring alternative approaches or configurations that could potentially resolve this challenge. The goal is to achieve a seamless execution of the docker_container
module within AWX’s custom execution environment, allowing for Docker operations as part of Ansible tasks.
Has anyone in the community faced a similar issue or achieved functionality akin to Docker-in-Docker or Docker alongside Docker within AWX’s execution environments? Any insights, guidance, or suggestions on configuring the execution environment or alternative solutions would be immensely appreciated.
https://github.com/ansible/awx/issues/15039
Thank you for your time and assistance.
Best regards.