Docker Community Forums

Share and learn in the Docker community.

Iptables permission denied

Hi there,

I meet an issue when building the docker image from Dockerfile.
In Dockerfile, I run command “dpkg -i package.deb”, When installing that package, it runs a command “sudo iptables …” and I got permission denied. Here is the output:

[INFO] DOCKER> /sbin/iptables
[INFO] DOCKER> [91miptables v1.6.0: can’t initialize iptables table `filter’: Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.

I have checked the user is root as you can see above.
I searched a lot about this problem, but they are always talking about this problem happen in step docker run NOT BUILD step.
So I wanna ask you guys, is it possible to run iptables command when building docker image.
Any help and explanation would be much appreciated.
Thanks a lot

1 Like