Docker Community Forums

Share and learn in the Docker community.

Docker image layer format difference: download directly from docker registry V1, V2 or Docker save


(Westlifezs) #1

Hello,

I am wondering the reason why docker image layers have different formats under different environment.
For example, if I check docker image layers first from docker registry v1 API by using “GET /v1/images/(image_id)/ancestry” , then I use: wget -O layer.data https://REGISTRY_URL:8080/v1/images/LAYER_ID/layer to download all of its layers and later I archive each layer data through “tar -cvf layer.data layer.tar”.

Comparatively, I “docker pull” the same image and then use "docker save” to store image I pulled from docker registry and untar the file into a number of tarred layers files along with a manifest.json file.
I compared the tarred data from file layers and the layer data I processed in earlier in the first paragraph and I realized their internal structure are completely different. I was told that if I download layer data from registry v2 then the internal format will be the same as we obtained through “docker save && tar -xvf”. My question is, is there a way to convert data I downloaded from registry v1 into the same format as the layer data stored through docker save? Any suggestions will be highly appreciated!