(OK) can't modify the kernel IP routing table in the container


https://groups.google.com/forum/#!topic/docker-user/gFHoaKpr7no

Hi,
I tried to modify the the kernel IP routing table in the container, like set default gateway or add routing record, they both are not permitted like below:

[root@1a066a5779fe ~]# route add default gw 10.175.177.176
SIOCADDRT: Operation not permitted
[root@1a066a5779fe ~]# ip route add 10.175.177.176/29 dev eth1
RTNETLINK answers: Operation not permitted
[root@1a066a5779fe ~]# route add -net 10.175.177.176 netmask 255.255.255.248 gw 10.175.177.169 dev eth1
SIOCADDRT: Operation not permitted

anyone knows why? who has solution or work around here?

best regards.
--------------------------------------------------------------------------------------------------------------------------------------------

Panagiotis Moustafellos

kernel network capabilities are not enabled by default.

You are going to need to run your container with --privileged

--------------------------------------------------------------------------------------------------------------------------------------------

Solomon Hykes

Note that, in addition to the (heavy-handed) --privileged, you can also enable individual capabilities with --cap-add.

--------------------------------------------------------------------------------------------------------------------------------------------

hi Panagiostis,


that's true. I just tried to start container with '--priviledged=true', it's working now. thanks very much for your help.

best regards.

--------------------------------------------------------------------------------------------------------------------------------------------

hi Solomon,


thanks for your advise, i will take chance to try it.

best regards.

posted @   张同光  阅读(108)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示