1. I think the "docker way" to get an updated version of PG from the main repository would to be to build a new docker image ("docker-compose build"). You could modify the Dockerfile to pull in PG from a different repository or branch, but to get it into a "fixed" Docker image, you would need to build the new image.
2. If you just want to handle local changes, you would modify docker-compose.yml to mount your local directory over what is inside the image, and then whatever is there will be used. (Most files are cached into the Apache process, so an apache restart or docker-compose down/up cycle is needed when files changed.)
OPL: In the current Docker setup it is stored on a persistent storage volume, so the following should work:
docker container exec -it webwork2_app_1 bash # Get a shell inside a running Docker container
git checkout master
# Maybe also do
# cd /opt/webwork/webwork2/