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> root
[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

Hey,

did you resolve this issue?

If resolved then please share the solution.

Thanks

You can’t install apps during Docker build if the app requires iptables. There are multiple reasons for that. First you would need extra privileges (docker run --privileged ) to usee iptables in a container. The second is that it does not make sense since you cannot configure network in an image.