Reputation: 2769
When I run /sbin/ebtables --list
in a Ubuntu Docker container, I get the message:
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.
How can I enable ebtables in Docker?
Upvotes: 2
Views: 2246
Reputation: 185
Adding mount helped me
cap_add:
- 'ALL'
volumes:
- '/dev:/dev'
- '/lib/modules:/lib/modules'
root@linuxbridge-agent:/# ls /lib/modules 5.4.0-26-generic 5.4.0-37-generic 5.4.0-39-generic 5.4.0-40-generic
Upvotes: 0
Reputation: 15822
By default docker doesn't support this capability. But you can pass below parameter while launching docker container to support Linux capability:
--cap-add Add Linux capabilities
--cap-drop Drop Linux capabilities
For Network capability like iptables, ebtables etc. you have to add NET_ADMIN
capability like:
docker run -it --cap-add=NET_ADMIN ubuntu bash
if ebtables
package not installed then install ebtables
package in container using command:
sudo apt-get update
sudo apt-get install ebtables
then list 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
Upvotes: 2