Docker Community Forums

Share and learn in the Docker community.

Docker Load doesnt work if the tar image unzipped and zipped again


(Nisha51088) #1

I am using Docker version
Client:
Version: 17.12.1-ce
API version: 1.35
Go version: go1.9.4
Git commit: 3dfb8343b139d6342acfd9975d7f1068b5b1c3d3
Built: Tue Apr 3 23:37:44 2018
OS/Arch: linux/amd64

Server:
Engine:
Version: 17.12.1-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.9.4
Git commit: 7390fc6/17.12.1-ce
Built: Tue Apr 3 23:38:52 2018
OS/Arch: linux/amd64
Experimental: false

I used docker save to get the image in tar. unzipped the tar image and zipped again to tar file. The docker load doesnt work . It gives the following error;
open /var/lib/docker/tmp/docker-import-776730007/tomcat/json: no such file or directory

Steps to reproduce:
docker pull tomcat:latest
sudo docker save tomcat:latest > /tmp/docker/tomcat_latest.tar
sudo tar -C /tmp/docker/tomcat -xvf /tmp/docker/tomcat_latest.tar
sudo tar czf /tmp/docker/tomcat_latest.tar /tmp/docker/tomcat_latest
sudo docker load -i /tmp/docker/tomcat_latest.tar

open /var/lib/docker/tmp/docker-import-776730007/tomcat/json: no such file or directory

Tried to use;
cat tomcat_tar.tar | docker import - tomcat:latest
but it creates a new tomcat image. But I dont want to have a new tomcat image.

If I dont untar the tar file, and continue executing the docker load, it works. But I wanted to untar the tar image. I understand that untar the image changes the structure of the image. Is there any safer command to untar the docker image, or how does the docker save create the tar file internally.


(David Maze) #2

…what are you really trying to do? In the past I’ve used docker save and docker load to get images on to systems that don’t have Internet access; and while I’ve peeked inside the tar file format before (it’s documented as part of the Docker HTTP-over-local-socket API) I was clear at the time that what I was trying to do was questionable at best, and in practice you should never need to actually do this.

(Your docker load command is probably failing because the file you’re feeding it is compressed.)


(Nisha51088) #3

@dmaze I wanted to look at the layers/blobs inside the image, so i am trying to unzip the tar file. I am actually sending the tar file to another machine. So i cant look at the layers using docker inspect image.