问题
I'm using Alpine Linux as a base for my containers, so no iptables for me, and I would rather not have to add it only for that.
I found this answer: https://stackoverflow.com/a/42336592/1326863 that tells that it is possible to disable internet in a docker's network, but is it possible to do it in docker-compose configuration?
回答1:
This db container cannot reach the Internet in my tests:
version: '3'
services:
db:
image: postgres:alpine
networks:
default:
internal: true
来源:https://stackoverflow.com/questions/45635331/docker-how-to-prevent-outgoing-traffic-from-a-dockers-network-using-docker-com