You can try this, pretty easy script
docker container kill $(docker ps | awk '/lookup_value/ {print $1}')
Explained
List containers in tabular structure
docker ps
Result
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
763e1a00808e 7bb2586065cd "docker-entrypoint.s…" 2 months ago Up 2 weeks 3306/tcp, 33060/tcp mysql_1
763e1a00999b 7bb2586065cd "docker-entrypoint.s…" 1 months ago Up 2 weeks 3307/tcp, 33061/tcp mysql_2
Isolate your container
awk /mysql_1/
Result
763e1a00808e 7bb2586065cd "docker-entrypoint.s…" 2 months ago Up 2 weeks 3306/tcp, 33060/tcp mysql_1
Isolate first tab value which is the container ID
awk ' /mysql_1/ {print $1}'
Result
763e1a00808e
So in conclusion this will isolate and send the kill or stop command the container id matching the image name