2

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?

Jehan
  • 2,701
  • 2
  • 23
  • 28

2 Answers2

2

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
pl_rock
  • 14,054
  • 3
  • 30
  • 33
0

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

user1435184
  • 185
  • 2
  • 5