Hello Folks!

So, you already read the title of this article. I felt the need to share Docker image that I have built with my colleague. But not via Docker hub or any other private or public container registry. Therefore, I tried to find what is the solution to it.

Basically Docker images are not stored in open form like LXCs as you can see below.

/root
/home
/proc
/dev
/tmpfs
/run

Initially I thought I can just copy files from data directory “/var/lib/docker/image” but it was not that easy :).

In order to share the image, we need to use some tools provided by Docker itself. Following command will export image to a tar file.

$ sudo docker save --output ubuntu-bionic.tar apexoutlook/ubuntu:bionic
$ ls -lh ubuntu-bionic.tar
-rw------- 1 root root 2.7G Mar  5 15:59 ubuntu-bionic.tar

From above command, we have got the image that can be copied to any other system. Once copied, this image can be imported using following command.

$ sudo docker load --input ubuntu-bionic.tar
$ sudo docker image ls

Finally we are able to share the images without relying on a registry creation. It was very simple I’ll say as easy as copying files ;).


Aryan

Hey Friends, Thank you for visiting my blog and spending some time reading it. Myself Aryan who works in computer technologies and keeps on pen down my understanding of various topics. This blog is a write-up of my understanding of various technologies after reading different materials about it. I hope that it helps you in some way.

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *