'Docker: How to do Python with ansible docker run into one not seperately

I have below two docker run which create two seperate container . But I want to merge them to one.

First one

docker build -f Dockerfile -t python .
docker run --rm -u $(id -u):$(id -g) -v "$PWD":/mnt python './abcd/efgh/execute.py' "user1" "user2"...

Second one

docker run -e ANSIBLE_HOST_KEY_CHECKING --rm -v $PWD:/mnt  dockerhub.com/ansible:2.9.24 ansible-playbook --user $USER -e "ansible_password=$PASS $PLAYBOOK_EXTRAVARS" -i $INVENTORY $PLAYBOOK $PLAYBOOK_ARGUMENTS --timeout 20

Can we run these above not in a separate docker run but in one docker run



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source