S
S
Serdonda2015-11-24 20:35:00
Disk image
Serdonda, 2015-11-24 20:35:00

Docker - how to import an existing machine?

Started getting familiar with Docker. And this question arose:
Is it possible to create a docker image of a running server (LAMP)?
If so, I would like some fairly detailed instructions or where to read about it.
Google has not yet given any clear answers - it all comes down to either downloading the finished image - which is not interesting because it is not known what is in those images and how it is configured.
Or to create an image from scratch.
So is it still possible to import an already running system into an image?
Thanks in advance for your replies.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Lebedev, 2016-01-13
@k3NGuru

Docker-Compose will help you.
It will allow you to download a separate docker image (PHP, Nginx\Apache, *SQL) and customize them for yourself.
I think this article will help to understand https://www.digitalocean.com/community/tutorials/h...
But this one will show how to build docker-compose with PHP and MySQL https://docs.docker.com/compose/wordpress/

K
kvaps, 2016-01-13
@kvaps

You need to copy your system to a separate folder, excluding directories such as /sys, /proc and /dev. After that, transfer the contents of this folder to tar and pipe it to the docker-import script.
Read up on how to create a baseimage. Also, for a better understanding of what is happening, you will need the skills to install linux manually, or at least an understanding of how the chroot works.
But in general this is not a true way, it's better to really create a new image from a pure
baseimage or use a ready-made one and import your configs into it. If you are afraid of bookmarks in other people's images, look for automated build images and look in the Dockerfile, good luck :)

H
HIQH, 2016-01-13
@HIQH

there are regular tools with the entire history of FS layers: docker-import and docker-export
"copy" option without saving history:

docker commit <container> <your-image>
docker save -o <tar-file-name> <your-image>
на destination машине:
docker load <tar-file-name>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question