Run command as -privileged in Dockerfile

I need bee -privileged to run a specific command in a Docker file, but I cannot find a way to tell docker for this.

Team RUN echo core > /proc/sys/kernel/core_pattern

If I put this in a Dockerfile, the build process will fail.

If I run Dockerfile with the specified line, but with the flag --privileged, then I can execute the command inside the container well.

Is there any solution to make everything work from a Docker file?

thank

+4
source share
1 answer

Not really a "Dockerfile", but you can do it with a script entry point, provided that you always start the container with --privileged

, , , , root.

, IMHO, -. , .

, (, , ).

:

root@terrorbyte:~# docker run -it alpine cat /proc/sys/kernel/core_pattern
core
root@terrorbyte:~# echo core2 > /proc/sys/kernel/core_pattern
root@terrorbyte:~# docker run -it alpine cat /proc/sys/kernel/core_pattern
core2
+1

Source: https://habr.com/ru/post/1666562/


All Articles