willhallonline / docker-ansible

Ansible inside Docker containers: Alpine, Ubuntu, Rocky & Debian with Ansible 2.16, 2.15, 2.14, 2.13, 2.12, 2.11, 2.10 and 2.9 + Mitogen
https://www.willhallonline.co.uk/project/docker/docker-ansible/
MIT License
392 stars 137 forks source link

container restarting loop #45

Closed sandikata closed 2 years ago

sandikata commented 2 years ago

Hello, today i tried to bring up container with ansible 2.10 but it's in restarting loop (tried 2.12 as well, but same).

docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 859de8ee5a7a willhallonline/ansible:2.10-alpine-3.15 "ansible-playbook --…" 9 minutes ago Restarting (0) 23 seconds ago ansible210

Any ideas or suggestions about this issue? Regards.

willhallonline commented 2 years ago

Hey @sandikata , I am not sure of the context of how you are running the container, however, what the container does by default entrypoint is run "ansible-playbook --version" and then close. This is mainly because Ansible wants you to do something rather than just starting and waiting for commands to be sent at some point to it?

I would imagine that most users are changing the command to something else. You can get it to start and just wait if you run a different command or change the ENTRYPOINT (use /bin/ash on Alpine and /bin/bash on others)? Something like:

docker run --rm -it willhallonline/ansible:2.10-alpine-3.15 /bin/ash
or
docker run --rm -it --entrypoint /bin/ash willhallonline/ansible:2.10-alpine-3.15

That would mean that the container starts and will hang around. Is that what you want?

willhallonline commented 2 years ago

Closing as no updates and not sure how to resolve.