Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker image format

I would like to build a Docker image without docker iself. I have looked at Packer, but it requiers to have Docker installed on the builder host.

I have looked at the Docker Registry API documentation but this information doesn't appear to be there.

I guess that the image is simply a tarball, but I would like to see a complete specification of the format, i.e. what exect format is required and whethere there are any metadata files required. I could attempt downloading an image from the registry and look what's inside, but there is no information on how to fetch the image itself.

The idea of my project is to implement a script that creates an image from atefacts I have compiled and uploads it to the registry. I would like to use OpenEmbedded for this purpose, essentially this would be an extention to Bitbake.

like image 255
errordeveloper Avatar asked Aug 30 '14 13:08

errordeveloper


People also ask

What is the format of Docker image?

The OCI format is a specification for container images based on the Docker Image Manifest Version 2, Schema 2 format. Container Registry supports pushing and pulling OCI images.

What format does Docker export images to?

gz file using gzip. You can use gzip to save the image file and make the backup smaller.

Is a Docker image a binary file?

Anatomy of a Docker Image This Dockerfile when executed converts your application into a Docker image (a binary of sorts) which you can then push to a registry from where it can be pulled to create new containers elsewhere.

Is Docker image same as Dockerfile?

Docker builds images automatically by reading the instructions from a Dockerfile -- a text file that contains all commands, in order, needed to build a given image. A Dockerfile adheres to a specific format and set of instructions which you can find at Dockerfile reference.


1 Answers

The Docker image format is specified here: https://github.com/docker/docker/blob/master/image/spec/v1.md

The simplest possible image is a tar file containing the following:

repositories
uniqid/VERSION
uniqid/json
uniqid/layer.tar

Where VERSION contains 1.0, layer.tar contains the chroot contents and json/repositories are JSON files as specified in the spec above.

The resulting tar can be loaded into docker via docker load < image.tar

like image 92
tmm1 Avatar answered Sep 30 '22 01:09

tmm1