How to create snapshot of the server as a docker image?

I have a centos 7 installed on a bare metal server. On top of it i install some custom sofware on it.

Is there a way to create a base image with os + software as a docker image. ?

Those custom software are not able to installed directly via Dockerfile, Instead it is running on bare metal centos server.

So is there a way to get the snapshot of the server as a docker image ?

You could probably tar up the root file system and docker import it – however, replicating an entire server with a variety of processes, full-blown init, etc. in Docker is generally not recommended. Here be dragons. Containers aren’t VMs, they’re just special processes.

Why? You cannot express the installation of this software as a series of invoked commands?

Thanks Nathan for your reply.

The problem not using the series of commands is "on my other post in the forum “tar extract failed inside docker using -O options”.

The instructions given in the custom software is not running inside the docker. That’s why I will search on a way to handle this.

–iVinoth

I’d try and figure out why your tar command isn’t working – solving that will likely be easier and result in a more robust solution

Yes it is . That’s great if we have a solution for the tar.

–iVinoth

Link for those who follow me https://forums.docker.com/t/inside-docker-tar-extract-failed-if-use-the-option-o/21309/2