相关文章推荐
阳刚的蚂蚁  ·  Linux ...·  3 周前    · 
深情的鞭炮  ·  Install .NET Runtime ...·  2 周前    · 
爽快的绿豆  ·  linux kill命令__linux ...·  2 周前    · 
冷静的消炎药  ·  使用 Python 分析 14 ...·  1 年前    · 
慷慨的高山  ·  android - Return a ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Why this error occurs 'You must run the container in the host namespace when running privileged mode'?

Ask Question

I have enabled user namespaces and now I wanted to run a docker container with --privileged flag, yes I know it's a bad practice but still I wanted to run that docker as --privileged.

But I can see this error pops-up, so was curious what is this error? What am I doing wrong?

docker: Error response from daemon: privileged mode is incompatible to user namespaces. You must run the container in the host namespace when running privileged mode'

Hello and welcome to StackOverflow! This question should be asked instead on the Unix&Linux or SuperUser communities. StackOverflow is for questions regarding programming. Daniel Walker Jan 30, 2021 at 3:26

From docker docs they said:

If you enable user namespaces on the daemon, all containers are started with user namespaces enabled by default. In some situations, such as privileged containers, you may need to disable user namespaces for a specific container. To disable user namespaces for a specific container, add the --userns=host flag to the docker container create , docker container run , or docker container exec command.

docker: Error response from daemon: privileged mode is incompatible to user namespaces. You must run the container in the host namespace when running privileged mode'

It is pretty clear in the error, to run your container with --previleged you have to run your container in the host namespace not in the custom namespace.

Hi sahadat, thanks for answering, can you please explain a bit more on host namespaces, I mean, is it true that the security provided by the user namespace will be useless if we use --userns=host? Hope you got my question? AWS Learning Jan 30, 2021 at 3:42 For more you can read these two portion of docker docs, Disable namespace remapping for a container and User namespace known limitations Sahadat Hossain Jan 30, 2021 at 3:49

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .