10 Docker Remote API Commands for Images - Flux7 Blog

In the last post of this series, we discussed Docker Remote API and explored the commands specific to containers. In this post, let’s discuss commands specific to images.

Create an Image

Images can be created in one of the following ways:

  • By performing a registry pull
  • By importing the image
POST /images/create

A sample request is shown in this screenshot.

create-an-image

Create an Image from a Container

To create an image from the container’s commits, use:

POST /commit

A sample request is in this screenshot.

docker-create-image-from-container

List of Images

To obtain the list of images, use:

GET /images/json

A sample request is shown in this screenshot.

docker-list-images

Insert a File

To insert a file at a specific path, use:

POST /images/(name)/insert

A sample request is shown in this screenshot.

docker-image-insert-file

Delete Image

To delete an image by name, use:

DELETE /images/(name)

A sample request is shown in this screenshot.

delete-an-image

Registry Push

To push an image to the registry, use:

POST /images/(name)/push

A sample execution is shown in this screenshot.

docker-push-image-to-remote-repo

Tag Image

To tag an image, use:

POST /images/(name)/tag

A sample execution is shown in this screenshot.

tag-an-image

Search an Image

To search for an image, use:

GET /images/search

A sample execution is shown in this screenshot.

docker-search-an-image

History

To view an image’s history, use:

GET /images/(name)/history

A sample execution is shown in this screenshot.

docker-get-image-history

Build an Image

An image can be built with DockerFile using:

POST /build

A sample execution is shown in this screenshot.

docker-build-image-from-dockerfile

We have now completed three legs of this Docker API journey. Check out the next post of this on-going Docker Tutorial Series, which you can find here every Thursday.

Did you find this useful?  

Interested in getting tips, best practices and commentary delivered regularly? Click the button below to sign up for our blog and set your topic and frequency preferences.

Sign Me Up!

July 03, 2014 / Docker, Docker Tutorials

About the Author

Flux7 Labs
Find me on: