# Docker Failed to find required executable "%s

**URL:** <https://forum.ansible.com/t/docker-failed-to-find-required-executable-s/39914>\
**Category:** Get Help\
**Tags:** rsync, ansible, docker-compose, docker, ubuntu, galaxy-ng\
**Created:** [January 29, 2025, 9:37pm UTC](https://forum.ansible.com/t/docker-failed-to-find-required-executable-s/39914 "2025-01-29T21:37:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpoles](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cpoles/32/4820_2.png) [@cpoles](https://forum.ansible.com/u/cpoles)\
**Post date:** [January 29, 2025, 9:37pm UTC](https://forum.ansible.com/t/docker-failed-to-find-required-executable-s/39914/1 "2025-01-29T21:37:06Z")

</div>

What I am trying to do:  
Create a docker image so that I can use docker to run playbooks.

What my problem is:  
Ansible cannot find the executable for the ansible.posix.synchronize module I am using in my playbook. Note, I have confirmed the module exists by running  
ansible-galaxy collection list

Error:

```auto
<10.16.29.75> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-1d52bc7yn/ansible-tmp-1738185054.6606917-31-140162884904275/AnsiballZ_synchronize.py && sleep 0'
marios_spaghetti | <10.16.29.75> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-1d52bc7yn/ansible-tmp-1738185054.6606917-31-140162884904275/ > /dev/null 2>&1 && sleep 0'
marios_spaghetti | The full traceback is:
marios_spaghetti | File "/tmp/ansible_ansible.posix.synchronize_payload__jvn6z1c/ansible_ansible.posix.synchronize_payload.zip/ansible/module_utils/basic.py", line 1421, in get_bin_path
marios_spaghetti | bin_path = get_bin_path(arg=arg, opt_dirs=opt_dirs)
marios_spaghetti | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
marios_spaghetti | File "/tmp/ansible_ansible.posix.synchronize_payload__jvn6z1c/ansible_ansible.posix.synchronize_payload.zip/ansible/module_utils/common/process.py", line 44, in get_bin_path
marios_spaghetti | raise ValueError('Failed to find required executable "%s" in paths: %s' % (arg, os.pathsep.join(paths)))
marios_spaghetti | fatal: [airflowdev]: FAILED! => {
marios_spaghetti | "changed": false,
marios_spaghetti | "invocation": {
marios_spaghetti | "module_args": {
marios_spaghetti | "_local_rsync_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
marios_spaghetti | "_local_rsync_path": "rsync",
marios_spaghetti | "_substitute_controller": false,
marios_spaghetti | "archive": true,
marios_spaghetti | "checksum": false,
marios_spaghetti | "compress": true,
marios_spaghetti | "copy_links": false,
marios_spaghetti | "delay_updates": true,
marios_spaghetti | "delete": true,
marios_spaghetti | "dest": "infogrid@10.16.29.75:/home/infogrid/cp_test_ansible",
marios_spaghetti | "dest_port": null,
marios_spaghetti | "dirs": false,
marios_spaghetti | "existing_only": false,
marios_spaghetti | "group": null,
marios_spaghetti | "link_dest": null,
marios_spaghetti | "links": null,
marios_spaghetti | "mode": "push",
marios_spaghetti | "owner": null,
marios_spaghetti | "partial": false,
marios_spaghetti | "perms": null,
marios_spaghetti | "private_key": null,
marios_spaghetti | "recursive": true,
marios_spaghetti | "rsync_opts": [],
marios_spaghetti | "rsync_path": null,
marios_spaghetti | "rsync_timeout": 0,
marios_spaghetti | "set_remote_user": true,
marios_spaghetti | "src": "/fake_dags",
marios_spaghetti | "ssh_args": null,
marios_spaghetti | "ssh_connection_multiplexing": false,
marios_spaghetti | "times": null,
marios_spaghetti | "verify_host": false
marios_spaghetti | }
marios_spaghetti | },
marios_spaghetti | "msg": "Failed to find required executable \"rsync\" in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
marios_spaghetti | }

```

Here is how my docker image is defined:

```auto
FROM ubuntu:latest

RUN apt-get update

RUN apt-get install -y python3

RUN apt-get install -y python3-pip

RUN apt install -y openssh-client

RUN apt install -y sshpass

RUN apt install -y python3 ansible

```

here is how my playbook is configured:

```auto
- name: fakedagdeployment
  hosts: airflowdev
  become: true
  tasks:
    - name: deploy fake dags
      ansible.posix.synchronize:
        src: /fake_dags
        dest: /home/infogrid/cp_test_ansible
        delete: true
        recursive: true

```

Here is my docker compose file:

```auto

services:
  ansible_poc:
    container_name: marios_spaghetti
    environment:
      ANSIBLE_HOST_KEY_CHECKING: False
    image: ansible-poc
    command: ansible-playbook -vvv -i ./inventory/hosts.yml --user infogrid ./playbooks/fakedagdeploy.yml
    volumes:
      - ./fake_dags:/fake_dags
      - ./inventory:/inventory
      - ./playbooks:/playbooks

```

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [January 29, 2025, 9:55pm UTC](https://forum.ansible.com/t/docker-failed-to-find-required-executable-s/39914/2 "2025-01-29T21:55:07Z")

</div>

You are missing `rsync`:

```auto
marios_spaghetti | "msg": "Failed to find required executable \"rsync\" in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

```

---

<div class="post-metadata">

**Author:** ![cpoles](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cpoles/32/4820_2.png) [@cpoles](https://forum.ansible.com/u/cpoles)\
**Post date:** [January 29, 2025, 10:15pm UTC](https://forum.ansible.com/t/docker-failed-to-find-required-executable-s/39914/3 "2025-01-29T22:15:23Z")

</div>

Thanks, I made the assumption rsync was installed and it is not I solved the issue by adding this line to my image code

RUN apt-get install -y rsync

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [January 29, 2025, 11:07pm UTC](https://forum.ansible.com/t/docker-failed-to-find-required-executable-s/39914/4 "2025-01-29T23:07:58Z")

</div>

I’d suggest the comment above from @sivel should be the solution, currently the comment that is marked as the solution appears to have been [copied from a StackOverflow comment](https://stackoverflow.com/q/79398282/9669328)…

---

<div class="post-metadata">

**Author:** ![cpoles](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cpoles/32/4820_2.png) [@cpoles](https://forum.ansible.com/u/cpoles)\
**Post date:** [January 29, 2025, 11:40pm UTC](https://forum.ansible.com/t/docker-failed-to-find-required-executable-s/39914/5 "2025-01-29T23:40:18Z")

</div>

Yep! I created that post 🙂 That’s why 🙂 but I am happy to edit and mark his as the solution. I just wanted to make sure the code to add to the image is explicitly called out.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [February 28, 2025, 11:40pm UTC](https://forum.ansible.com/t/docker-failed-to-find-required-executable-s/39914/6 "2025-02-28T23:40:54Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
