当我在 Ubuntu Docker 容器中运行 /sbin/ebtables --list
时,我收到消息:
root@500790dca629:/core-release-4.8# /sbin/ebtables --list
modprobe: ERROR: ../libkmod/libkmod.c:557 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.43-boot2docker/modules.dep.bin'
The kernel doesn't support the ebtables 'filter' table.
如何在 Docker 中启用 ebtables?
最佳答案
默认情况下,docker 不支持此功能。但是您可以在启动 docker 容器时传递以下参数来支持 Linux 功能:
--cap-add Add Linux capabilities
--cap-drop Drop Linux capabilities
对于 iptables、ebtables 等网络功能,您必须添加 NET_ADMIN
功能,例如:
docker run -it --cap-add=NET_ADMIN ubuntu bash
如果未安装 ebtables
软件包,则使用以下命令在容器中安装 ebtables
软件包:
sudo apt-get update
sudo apt-get install ebtables
然后列出 ebtables:
/sbin/ebtables --list
Bridge table: filter
Bridge chain: INPUT, entries: 0, policy: ACCEPT
Bridge chain: FORWARD, entries: 0, policy: ACCEPT
Bridge chain: OUTPUT, entries: 0, policy: ACCEPT
关于docker - 如何在 Docker 中使用 ebtables?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42060254/