今天想启用这个功能,
这样,docker里的root用户,就不用是宿主机的root用户,
安全性可以提高一个层次。
于是找了文档,对比了配置,default用了,自定义用了,
结果呢?
傻眼了~~~~全都失败。
~~~~~~~~~~~~~~~~~~~~
花了几小时,再想找找为何失败,
结果,原来在centos/rhel中, user namespaces只是一个预览功能。
要用命令才能开启!!!!
OMG,不知敢不敢用了。
http://cache.baiducontent.com/c?m=9d78d513d9951cfe01bad4690d6790274e1497624c8b91027ea48448e5735a310731bce8653657448dca262147ed084beb832b6f675d7de28cc8ff1b9cedce3f2fff7b633601d31453985eaaca44389260d601b8f14efaeca774c0f58c92c25158ce50067f87f3&p=c27ec54ad5c516f30be296605055&newp=8b2a970e8ed505fd11bd9b7d0b4092695803ed633fd6d301298ffe0cc4241a1a1a3aecbf2025110fd7c2786703a44b58ecf03273330834f1f689df08d2ecce7e64d031702255&user=baidu&fm=sc&query=docker+userns-remap&qid=a68e3d2a000023c9&p1=11
https://segmentfault.com/q/1010000010909708
https://bugzilla.redhat.com/show_bug.cgi?id=1349704
========================
grubby --args="user_namespace.enable=1" --update-kernel="$(grubby --default-kernel)"
reboot
If you're using CentOS 7, there are two things you need to know.
1.User Namespaces is not enabled on the kernel by default. You can enable it by executing the following command and restart the system.
sudo grubby --args="user_namespace.enable=1" \
--update-kernel=/boot/vmlinuz-3.10.0-XXX.XX.X.el7.x86_64
The user namespaces are "Technology Preview" and disabled by default, see kernel implementation https://bugzilla.redhat.com/show_bug.cgi?id=1138782
If I good remember you need to enable it on kernel command line
(something like grubby --args=user_namespace.enable=1 + reboot).