Run command as –privileged in Dockerfile

I need to bee –privileged to run a specific command in the Dockerfile but I can’t find a way to tell docker to do so.

The command is RUN echo core > /proc/sys/kernel/core_pattern

  • How to setup Docker for a polyglot microservice-based application?
  • how to make opencv processing distributed on many hosts
  • Jenkins docker cache not working
  • How to create a base CoreOS image and build custom parent images based on it
  • How can I get environment variables of docker in node js?
  • docker container: add symlink to /Users/www/[project] in /var/www to access and serve local files
  • If I put that in the Dockerfile the build process fails.

    If I run the Dockerfile with that line commented but with the flag --privileged then I can run the command well within the container.

    Is there any solution to make everything work from the Dockerfile?

    Thank you

  • Docker Toolbox setup fails on Windows 8.1
  • how can i restore the plugin data of errbot running in a docker container
  • Docker failing to load apparmor profile upon ubuntu host boot
  • How to copy docker images from one host to another?
  • How to make communicate between nginx and php container
  • boot2docker fails to start on windows 7
  • One Solution collect form web for “Run command as –privileged in Dockerfile”

    Not exactly “Dockerfile”, but you can do this with an entrypoint script provided you always run the container with --privileged

    That being said, I would warn against this if at all possible as part of the beauty of docker is that you aren’t running things as root.

    A more better alternative, IMHO, is instead to change this on the host system. In that way, it will be reflected within the container as well.

    The only caveat to that is that that will be reflected on all containers on that system (and of course, the system itself).

    Here is a proof of concept for my suggested solution:

    root@terrorbyte:~# docker run -it alpine cat /proc/sys/kernel/core_pattern
    root@terrorbyte:~# echo core2 > /proc/sys/kernel/core_pattern
    root@terrorbyte:~# docker run -it alpine cat /proc/sys/kernel/core_pattern
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.