I had a similar problem where after connecting to a VPN, my containers couldn’t access the internet. I’ve managed to solve this by adding the network
flag to the builds section of my compose files:
version: '3.4'
serivces:
some_service:
build:
network: host
...
Hope that helps!