Add the following to your bashrc.
function dock()
{
if [ "$1" == "-h" ]
then
printf "Accepts container name or id, or attach to first running process \n"
elif [ $# -eq 0 ]
then
dockerid="$(docker ps -q | head -1)"
echo $dockerid
sudo docker exec -i -t $dockerid /bin/bash
elif [ "$1" != "-h" ]
then
sudo docker exec -i -t $1 /bin/bash
fi
}