9

Is there a quick way to save the state of a docker container started with the --rm flag, as if you didn't specify it?

3
  • 2
    I'd try exporting the running container and importing it as a new image. That should keep your file system state. Commented Jan 26, 2016 at 8:46
  • 4
    Not at a computer where I can test right now, but something like docker export -o temp <container id> and docker import temp mycopy. Then you should be able to just run the image mycopy as usual. Commented Jan 26, 2016 at 8:49
  • Does this answer your question? Cancel --rm option on running docker container Commented Apr 29, 2021 at 11:08

1 Answer 1

4

Only the upcoming 1.10 docker update command would be able to (eventually) do that (cancel a --rm option)

But the 1.10 version of that command only supports resource configs.
It will be extended though in the future.

So for now, this does not seem possible.
You would have to stop it and relaunch it with the right set of options.

Note: if the issue is that a volume referenced by that container would be lost if you stopped (and automatically remove) said container, know that you can re-attach that volume to a new container.

The docker export mentioned by Joachim Isaksson in the comments is one workaround, but it has limitation (ie it won't export volume)

Sign up to request clarification or add additional context in comments.

1 Comment

@Nishant That does not seem supported yet in docs.docker.com/engine/reference/commandline/update. As an example, codeburst.io/… shows how to update the restart policy. But not amend the rm option.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.