Zookeeper docker container stuck

We’ve been using zookeeper as part of our Kafka deployment and for other usages as well (via docker-compose).

Occassionally the docker image would stop to function, to the point where docker stop zookeeper would not return (zk would keep running).
Also docker kill -s SIGTERM would not kill it.

when that happens, attempts to run zkCli from within the container also halt (the zkCli.sh command doesn’t return).

Only killing the docker service (on Mac the docker app) would allow to recover it – but only after deletion of the container while zk is still down.

Any idea how to troubleshoot this?
What could cause such scenario?

Source: StackOverflow