Mounting/resolving a docker volume through another container's network

I have a VPN connection running inside container A to an offsite location. I want to mount a NFS volume from that offsite location using the the VPN connection from container A in container B. This works fine for commands running inside container B, e.g mysql, postgres, but when I try with a volume created by docker volume command and mount it to container B specifying container A as the network for container B it doesn’t work.

I assume that is because the addr part of the volume is resolved on the host and not by the container? Is it possible to configure the volume to use the containers network by any chance? Or is there another way around this?

Correct. The mount is done on host level. Your host has no route to target vpn network. You could try to add the route and see if it helps. In this scenario it makes sense to pin down the container ip of your vpn container. Though, I feel this will be somehow a brittle solution.