Methods for working with a particular docker image. Image objects are returned by building or pulling a docker image, or by using $image$get to fetch an existing image by name or id.

Details

Below is reference documentation for all methods for version '1.29' of the docker API - other versions are available. This documentation is automatically generated from docker's API schema, and so inaccuracies may exist between it and stevedore's interface (especially references to JSON objects). Please report any documentation that might be improved at https://github.com/richfitz/stevedore/issues

Methods

image_tarball

Export an image. Get a tarball containing all images and metadata for a repository.

If name is a specific name and tag (e.g. ubuntu:latest), then only that image (and its parents) are returned. If name is an image ID, similarly only that image (and its parents) are returned, but with the exclusion of the repositories file in the tarball, as there were no image names referenced.

### Image tarball format

An image tarball contains one directory per image layer (named using its long ID), each containing these files:

  • VERSION: currently 1.0 - the file format version

  • json: detailed layer information, similar to docker inspect layer_id

  • layer.tar: A tarfile containing the filesystem changes in this layer

The layer.tar file contains aufs style .wh..wh.aufs files and directories for storing attribute changes and deletions.

If the tarball defines a repository, the tarball should also include a repositories file at the root that contains a list of repository and tag names mapped to layer IDs.

json
{
  "hello-world": {
    "latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"
  }
}

. Similar to the cli command docker image save.

Usage:

  image_tarball()
help

Display help for this object

Usage:

  help(help_type = getOption("help_type"))

Arguments:

  • help_type: Passed to utils::help, can be one of "text", "html" or "pdf" (or an abbreviation). By default it uses the value getOption("help_type") and should follow the same behaviour as other R help (e.g., using "?")

image_history

Get the history of an image. Return parent layers of an image. Similar to the cli command docker image history.

Usage:

  image_history()
id

Return the image's id

Usage:

  id()
inspect

Return detailed information about this image. Similar to the cli command docker image inspect.

Usage:

  inspect(reload = TRUE)

Arguments:

  • reload: Logical scalar, indicating if the information should be refreshed from the daemon. This is useful to set to FALSE after an image has been removed.

labels

Return labels for this image

Usage:

  labels(reload = TRUE)

Arguments:

  • reload: Logical scalar, indicating if the information should be refreshed from the daemon. This is useful to set to FALSE after an image has been removed.

name

Return name for this image

Usage:

  name()
reload

Refresh infomation on the image from the server, returning $inspect() invisibly.

Usage:

  reload()
image_delete

Remove an image. Remove an image, along with any untagged parent images that were referenced by that image.

Images can't be removed if they have descendant images, are being used by a running container or are being used by a build. Similar to the cli command docker rmi or docker image rm.

Usage:

  image_delete(force = NULL, noprune = NULL)

Arguments:

  • force: Remove the image even if it is being used by stopped containers or has other tags

  • noprune: Do not delete untagged parent images

short_id

Abbreviated identifier, truncated to 10 characters (perhaps plus the leading sha256:

Usage:

  short_id()
image_tag

Tag an image. Tag an image so that it becomes part of a repository. Similar to the cli command docker tag or docker image tag.

Usage:

  image_tag(repo, tag = NULL)

Arguments:

  • repo: The repository to tag in. For example, someuser/someimage.

  • tag: The name of the new tag.

tags

Return tags for this image

Usage:

  tags(reload = TRUE)

Arguments:

  • reload: Logical scalar, indicating if the information should be refreshed from the daemon. This is useful to set to FALSE after an image has been removed.

untag

Remove tags from the image. This is a lot like image$remove (see docker_image_collection) but with noprune = TRUE.

Usage:

  untag(repo_tag)

Arguments:

  • repo_tag: Tags to remove

See also

docker_image_collection for other image management methods.