Facebook

Creating docker image of your own file system.


We can create the docker image of our own system i.e. the host system on which docker is running. This might be handy in cases where your system have everything already setup and all the tool are configured and you want to replicate the same on another system. Instead of starting from scratch and installing everything on another system we can create an image of our system and use it.

Here 'Docker' comes to our rescue. To read more about docker go to their homepage.



In order to accomplish what is told above, first we need to make a tar file of our file system, which can be achieved using below command.

tar --numeric-owner --exclude=/proc --exclude=/sys -cvf ubuntu-base.tar /

Now when you have the tar file of your file system, we can create the docker image from it.

cat ubuntu-base.tar | docker import - ubuntu-base

This will create the docker image with the name 'ubuntu-base'.

verify the image by running the image with docker.

docker run -i -t ubuntu-base

Run any command and browse through the file system and you will see your old file system in new avatar.