Create Image with privileged option?

Hi guys,

I got a little question :
If I RUN a container with --privileged option, I do some stuff inside, and I want after to commit the container in a new image. Does the new image have the privileged mode too ??

Thank you

Images never intrinsically have privileged mode. (They never “keep” most docker run options, including network configuration, host/named volume attachments, kernel privileges, etc.)

(What are you trying to do that you want this?)

Hi dmaze, thank you for your answer.

I was wondering, just by curiosity…

But your answer create a new question. Correct me if I’m wrong.

The command docker run, create and start a new container.
The command docker run can be completed by some option ( --privileged, --net, etc …).

If I run a new container (call him container_x) with some option :

Then I stop it:

How can I start again my container_x with all my previous option ( --privileged, etc …) ??
Do I have to run, and therefore, create a new container every time I stop it ?

Thank you

docker start container_x should restart it with all of the options it had before. And, since you mentioned create, I’m pretty sure run is the same as create plus start together.

Containers aren’t supposed to be “precious”; a container getting stopped or even deleted shouldn’t be an operational problem.

If you do need to start containers with complex options, you can write a simple shell script with the complete docker run command (which is what I do) or put all the options in a Docker Compose YAML file.

Ok thank you very much for your explanation