0

I'm using docker as a "light" virtual machine. For example, when I need to do some experiments on Ubuntu and don't want to mess up the host OS, I simply run docker run -it ubuntu bash.

Generally I'm very happy with it, except that I cannot keep the changes after I exit, which means I need to rerun

apt update && apt install vim git python python3 <other_tools> && pip install flask coverage <other_libraries> && .....

every single time I start the docker container as a VM, which is very inefficient.

I've noticed this question, but it only enables me to keep some specific files from being erased, whereas I want the whole system (including but not limited to all configuration, cache and tools installed) to be retained between the life cycles of the docker container.

nalzok
  • 14,965
  • 21
  • 72
  • 139

1 Answers1

1

You must use something like

docker commit mycontainer_id myuser/myimage:12

see the doc: docker commit

and then you launch your saved image myuser/myimage:12

But you should definitely use a Dockerfile

nalzok
  • 14,965
  • 21
  • 72
  • 139
user2915097
  • 30,758
  • 6
  • 57
  • 59