Hi;
I think I know what I need to do if I were running a bash script to
manage Docker containers.
But I'm not sure how to leverage that knowledge into Ansible conditionals.
My problem is that I need to make certain that there are no Docker
containers (running or not) that match a certain name (actually at
this point, any Docker container), prior to starting it up (docker
run).
I wish that the Ansible Docker module supported query operations.
My query (via bash shell) is basically: "sudo docker ps" or "sudo
docker ps -a" where I usually parse the output via one or more of the
grep, awk, wc and tr commands. If I know that the docker container
does not exist then I will create a new one (perhaps with different
options).
My solution right now is to "docker rm -f $(docker ps -a -q)" which
loudly screams if there are no docker containers.
I'd like to program in such a way as that there are no ugly red responses
Thanks,
Ken Wolcott