Fetch module returns "unable to calculate the checksum of the remote file" while running in Docker but works fine when not in Docker

  ansible, ansible-2.x, docker

Ansible playbook (copy_file.yml):

- name: Copy this file over please
  hosts: all
  gather_facts: false
    - name: Get files from scanners running in each DC
        src: /tmp/file_to_copy
        dest: /tmp/local_place
        flat: yes
        fail_on_missing: yes
        validate_checksum: no

Command: ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i inventory playbook/copy_file.yml

It works when I run it.

But when I dockerize it, it gives me the error:

fatal: [remotehost.com]: FAILED! => {"changed": false, "file": "/tmp/file_to_copy", "msg": "unable to calculate the checksum of the remote file"}

My dockerfile is very simple. It just copies a script that contains the ansible command and runs it. Its base image is Alpine Linux.

FROM some_url/alpine/python:3.7-alpine

RUN apk add --no-cache musl-dev libffi-dev openssl-dev
RUN apk add build-base
RUN apk add bash

COPY / /

RUN pip install -r requirements.txt

ENTRYPOINT ["/run.sh"]

Source: StackOverflow