Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Way to set "--rm" flag for Ansible Docker module?

Tags:

docker

ansible

I am using the Ansible Docker module and trying to run docker with the "--rm" flag set. However, I do not see an option for specifying to use the "--rm" flag or a way to pass in which Docker flags to set on the Ansible Docker Module.

Is there a way to set the "--rm" flag when starting a container with the Ansible Docker module?

Thanks

like image 276
ben_frankly Avatar asked Oct 24 '25 00:10

ben_frankly


1 Answers

The Docker module linked by OP is deprecated and @Lexandro's answer is outdated.

This is now supported in the newer module named docker_container as the auto_remove feature (added in 2.4)

like image 187
StartupGuy Avatar answered Oct 27 '25 00:10

StartupGuy