Docker: How to prevent outgoing traffic from a docker's network using docker-compose and no iptables?

会有一股神秘感。 提交于 2021-02-07 04:25:15

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!