2

I'm trying to understand the difference between images used in KVM / VMware / VirtualBox and Docker images + containers.

I can use i.e. an Ubuntu ISO to install the entire operating system into i.e. VirtualBox, essentially writing everything into an image file stored somewhere on the machine. Now, if for whatever reason I decide that I want to move the Ubuntu image and run it on a different computer, I can just copy the image to that other computer and run it from there.

Now, Docker also has images that may also have Ubuntu inside running pretty much any application. I have to setup a container that stores all my changes and states. Now, if I want to do the same thing as I did with the VirtualBox image, transfer my Docker image + container to another computer and run it from there, this step seems to be pretty difficult. I can't really understand why.

So my question is, what exactly is the conceptional difference between Docker images and the other ones mentioned above? Why can't I just copy those images around machines as I please?

2

Docker is used to run microservices, where it uses the resource isolation features of the Linux kernel such as cgroups and kernel namespaces, and a union-capable file system such as OverlayFSand others to allow independent "containers" to run within a single Linux instance, avoiding the overhead of starting and maintaining virtual machines (VMs). It's quite different from VMs, moving docker image can be as easy, you just need to understand how docker works. Also you can use some orchestration manager that can orchestrate docker containers, such tool is kubernetes with it you get a lot of benefits, it managing of containers much easier.

  • Thanks for your input. I understand that Docker has a lower overhead compared to traditional VMs. Is there an easy way to move a docker container without using kubernetes? – Socrates Apr 19 '18 at 12:24
  • Yes docker container is ran by image, just run the image on another machine. – AsenM Apr 19 '18 at 12:26
  • I mean, is there an easy way to transfer a container (with my changes, i.e. apps I installed) to another computer, so that I can continue my work on the exact same Docker container, but on the other computer? – Socrates Apr 19 '18 at 12:29
  • I don't know of such way, other than building new image of your working container and just running it on new machine. I'm sorry if I'm not helpful enough. – AsenM Apr 19 '18 at 12:31
  • 2
    Yes, @Socrates, there are ways. For example docker commit. You create an image with your changes, move the image somewhere, create a new container using that image. – Lenniey Apr 19 '18 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.