First of all you have two containers running and not two dockers. Containers are isolated from each other and the host. docker exec can be used only on the docker host, not inside a container. I am quite sure the postprocess scripts are not designed to run docker exec commands.
The postprocess script can be a wrapper at best, that commands a remote “handbreak server” (i your case container B) to perform an action.
In case you created a docker-compose.yml for your setup, I might be willing to give a look at it. If you just used commands, then someone else needs to pitch in.