#!/bin/bash

function usage {
    echo "USAGE dtrestart pattern"
    exit 1
}

if [ $# -lt 1 ]; then
    usage
fi

PAT="$1"

while read container
do
    docker restart $container
done < <(docker ps -a --format "{{.Names}}" | grep "$PAT")

