I need to create docker base image with CentOS and MySQL. But I already have such VM (without docker on it). How can I create base docker image from this existing VM and use it on another machine with docker?
While the other commenters have pointed out correctly that importing a VM into Docker is not the intended way to create images, it is possible and can provide you with a fast starting point to test things before you fully commit. To do this, you simply provision a linux root file system (in your case: your CentOS VM) and stream it into docker import like so:
tar -cC [folder containing provisioned root fs] . | docker import - [image name]
Docker's base image documentation has more info and even links to a script to create a CentOS base image.
I think you misunderstand what docker does (or I misunderstand your question). Docker is not a VM provider; it's a container management mechanism based on libcontainer. In your case, I would do something like
The nice thing is once you go through this exercise, you have a script that tells you exactly how you created your image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With