There are many a times where I had to run commands across all docker containers. Here is an handy script to do that:
$ cat runCommandAllDockers.sh
for container in `docker ps -q`; do
# show the name of the container
docker inspect –format='{{.Name}}’ $container;
# run the command (date in the case)
docker exec -it $container $1;
done