[英]How to run an iptables command for docker for windows when using WSL2
I am running Ubuntu 20.04 on WSL 2 along with docker desktop (2.3.0.5) for Windows.我在 WSL 2 上运行 Ubuntu 20.04 以及 Windows 的 docker 桌面(2.3.0.5)。
Docker desktop has been setup so that I can access the docker daemon from my Ubuntu shell. Docker 桌面已经设置好,所以我可以从我的 Ubuntu shell 访问 docker 守护进程。
I would like to run the command (see this question for motivation for running the command):我想运行该命令(有关运行该命令的动机,请参阅此问题):
sudo iptables -I DOCKER-USER -j DROP
but when I do I get the error: iptables: No chain/target/match by that name.
但是当我这样做时,我收到错误: iptables: No chain/target/match by that name.
According to the docker documentation : "Docker installs two custom iptables chains named DOCKER-USER and DOCKER, and it ensures that incoming packets are always checked by these two chains first."根据 docker文档:“Docker 安装了两个名为 DOCKER-USER 和 DOCKER 的自定义 iptables 链,它确保传入的数据包始终首先由这两个链检查。”
How can I apply this iptable rule to the docker desktop installation on windows?如何将此 iptable 规则应用于 Windows 上的 docker 桌面安装?
The documentation specifies that it's a feature for a Linux environment.该文档指定它是 Linux 环境的一项功能。
On Linux, Docker manipulates iptables rules to provide network isolation.在 Linux 上,Docker 操纵 iptables 规则来提供网络隔离。
Have you tried using iptables within WSL2 itself?您是否尝试过在 WSL2 中使用 iptables? If you're using Docker desktop with the WSL2 Ubuntu integration, it might work.如果您将 Docker 桌面与 WSL2 Ubuntu 集成一起使用,它可能会工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.