1.Creating docker tar file from docker image.We can transfer that tar file and import to another docker instance.

root@deb-VirtualBox:~# docker image save mywebserver:v1>mywebserver.tar
root@deb-VirtualBox:~# ls -ltr mywebserver.tar
-rw-r–r– 1 root root 330399232 May 2 19:53 mywebserver.tar

2.Remove the existing docker image 

root@deb-VirtualBox:~# docker rmi -f mywebserver:v1
Untagged: mywebserver:v1

3.Please note the image is deleted

root@deb-VirtualBox:~# docker images

4.Now we can re-import docker image from docker tar

root@deb-VirtualBox:~# docker import mywebserver.tar mywebserver:v1
sha256:d749c49988b578c7f3183eccdf135520f4b1e8778a3770c4ad9755f32d243b3f

root@deb-VirtualBox:~# docker import mywebserver.tar mywebserver:latest
sha256:1d666b38b200ec0c6c47399890b15ba856b3ae2811cd8c90080f1faa81ed9c56

5.I have 2 images of the mywebserver

root@deb-VirtualBox:~# docker images

Leave a Reply

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