docker

Docker start privileged?


I'm quite new to Docker. I have a Docker container running:

[root@vm Downloads]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
fc86020fff36        centos:6.6          "/bin/bash"         5 days ago          Up 17 hours                             drunk_tesla  

I want to stop this vm and run it as --privileged. But I have a bunch of things in it.

I don't want to use --run because it creates a new Docker instance and I have to re-do everything.

Is there anyway I can stop and start the Docker container in privileged mode?


Solution

  • Since the docker image you used (centos:6.6) for creating this container has no volumes, that means that any data you modified in this container is written on the container filesystem itself (as opposed to on a docker volume).

    The docker commit command will take the content of a container filesystem (excluding volumes) and produce a new docker image from it. This way you will be able to create a new container from that new image that will have the same content.

    docker commit drunk_tesla mycentosimage
    docker run -it --privileged mycentosimage bash