I have a list of PID\'s and I need to get their docker container name. Going the other direction is easy ... get PID of docker container by image name:
$ doc
Because @Mitar's comment suggestion deserves to be a full answer:
To get container ID you can use:
cat /proc//cgroup
Then to convert the container ID to docker container name:
docker inspect --format '{{.Name}}' "${containerId}" | sed 's/^\///'