I use Config.Image it's a field of the container's inspect output plus jq to parse the JSON output :
Config.Image
jq
docker inspect <container-id/name> | jq -r '.[0].Config.Image'