A warm Hello to all the readers!
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 ;).