The preferred way to get the git revision is using a --workspace_status_command, like
tools/buildstamp/get_workspace_status. There might be a more direct way, but you could get the information into a Skylark rule by calling a HOST cc_binary which depends on a cc_library with something in the linkstamp attribute.
One thing to note is the git revision changing won't cause the rules to be rebuilt. Instead, whenever the rules are rebuilt because any other dependencies changes, the current git revision will be retrieved and used.
I don't know how to get the information from the workspace status files into the docker rules.