我想运行一个带有中央日志和fail2ban服务的docker容器来防止dos / ddos攻击.
我有一个问题是运行具有这种功能的容器,它也可以修改主机iptables.
有一个项目ianblenke/docker-fail2ban然而它不起作用……
赋予容器标志特权只允许我控制此容器上的iptables.有没有办法通过容器控制主机iptables?
问候.
最佳答案
默认情况下,Docker容器在隔离的网络命名空间内运行,在该命名空间中,它们无法访问主机网络配置(包括iptables).
如果希望容器能够修改主机的网络配置,则需要将–net = host选项传递给docker run.从docker-run(1)手册页:
--net="bridge"
Set the Network mode for the container
'bridge': creates a new network stack for the container on the docker bridge
'none': no networking for this container
'container:': reuses another container network stack
'host': use the host network stack inside the container.
Note: the host mode gives the container full access to
local system services such as D-bus and is therefore
considered insecure.
您需要同时运行–privileged和–net = host.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。