How can I use a docker container as a substitute for a regular VM?

  Kiến thức lập trình

If I wanted to create a Docker Container as a substitute or replacement for a VM, how would I go about doing this?

As an example, let’s say I wanted to spin up a Ubuntu VM (without a GUI), but can’t because I do not have VirtualBox, etc. However I do have Docker.

The Container should:

  • have persistent storage (if I run apt install vim, then this change should persist between reboots of the Container)
  • not automatically shut itself down (eg if you close the only running bash session)
  • allow the user to attach and add more bash sessions dynamically, each one acting as a virtual terminal

Is it possible to do this?

LEAVE A COMMENT