Your command is almost complete. It should be $docker inspect -f '{{.State.Pid}}' <container_id>. For docker stats, you may also need to run it as sudo.
$docker inspect -f '{{.State.Pid}}' <container_id>