我想只允许从特定的docker容器向指定的url发送http请求。有没有相对无痛的方法呢?
答案 0 :(得分:1)
I don't think so. The only* way to implement this sort of per-URL restriction is if all requests were made through a proxy, so you would need to (a) set up a proxy, (b) configure the rules appropriately, (c) arrange for tools inside your container to use the proxy and (d) ensure that your container has no other outbound access.
So, maybe that would like...
docker network create --isolated mynetwork
)docker network connect...
)docker run --net=mynetwork...
)I would not describe that as "relatively painless".
*Well, you might able to hack something together using iptables and string-matching inside packets, but just saying that makes me feel unclean.