Work with containers' images
Go to file
Nalin Dahyabhai 82e03e5c89 Rework how we use storage for storing images
This patch overhauls how we use containers/storage to store images,
dropping most of our own metadata in favor of facilities that are
now provided by default by the storage library.  Additionally:
* storageImageDestination now caches blobs in a temporary directory
  until Commit() is called
* storageImageDestination generates a barebones manifest if one isn't
  supplied before Commit() is called
* storageImageDestination uses new APIs in containers/storage to
  look for a local layer with the same contents of a blob, making it
  better at noticing when a PutBlob() isn't necessary
* storageImageDestination sets the creation date for the image if it
  can be determined during Commit()
* storageImageDestination defaults to using the hex part of the digest
  of the image's configuration blob as an image's ID, making it better
  at catching re-pulls of the same image
* storageImageDestination no longer discards names which have been set
  for an image when reusing an ID
* storageImage now counts sizes of uncompressed data when determining
  image size
* storageImage now counts the size of the configuration blob when
  computing an image's size
* storageImage returns an updated image with the manifest listing
  uncompressed layer blobs
* storageImageSource also returns such an updated manifest
* storageImageSource now always returns uncompressed layers

Test changes:
* storage tests now always write an image manifest
* the test for determining an image's size now actually writes the
  configuration blob that it later tries to read

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-12-04 10:14:33 -05:00
copy Add architecture/OS overrides to types.SystemContext 2017-11-15 20:06:05 +01:00
directory Add architecture/OS overrides to types.SystemContext 2017-11-15 20:06:05 +01:00
docker Issue #368 Making OCI and Docker daemon transport work on Windows 2017-11-26 13:08:04 +02:00
docs Add a "tarball" transport for importing tarballs 2017-11-02 09:58:05 -04:00
image Add a test for chooseDigestFromManifestList 2017-11-15 20:06:05 +01:00
internal Issue #368 Making OCI and Docker daemon transport work on Windows 2017-11-26 13:08:04 +02:00
manifest Revert "Hotfix: Do not fetch manifest lists from Docker registries" 2017-11-15 20:06:05 +01:00
oci Issue #368 Making OCI and Docker daemon transport work on Windows 2017-11-26 13:08:04 +02:00
openshift Add architecture/OS overrides to types.SystemContext 2017-11-15 20:06:05 +01:00
ostree ostree: support only uncompressed images for now 2017-11-22 07:59:27 +01:00
pkg Add docker/config package to containers/image/pkg 2017-10-09 21:56:49 -04:00
signature Do not Close the ImageSource in UnparsedImage/Image 2017-11-15 20:06:05 +01:00
storage Rework how we use storage for storing images 2017-12-04 10:14:33 -05:00
tarball Add architecture/OS overrides to types.SystemContext 2017-11-15 20:06:05 +01:00
transports Stub out the right transport name for storage 2017-11-03 16:25:53 -04:00
types Add architecture/OS overrides to types.SystemContext 2017-11-15 20:06:05 +01:00
version version: adjust variables 2016-06-27 17:44:35 +02:00
.gitignore Issue #155 Making sure existing OCI index gets not overwritten 2017-10-31 15:27:19 +01:00
.pullapprove.yml *: add pullapprove 2016-06-27 16:34:59 +02:00
.travis.Dockerfile Update CI image to run tests against go version 1.8 2017-10-03 11:51:45 +01:00
.travis.yml travis.yml: use a Docker container to run the tests 2017-06-06 17:12:16 +02:00
CONTRIBUTING.md Modify CONTRIBUTING.md to prefer smaller commits over squashing them 2017-11-06 16:13:33 +01:00
LICENSE Move to Apache 2 license 2016-06-24 11:35:34 -07:00
MAINTAINERS *: add MAINTAINERS 2016-06-27 16:34:59 +02:00
Makefile Issue #324 Adding build target 2017-10-31 16:21:15 +01:00
README.md Disable the ostree transport on macOS 2017-08-31 21:17:59 +02:00
doc.go doc.go: Update intro source example 2017-02-06 15:26:38 -08:00
registries.conf Add registries.conf file and build library to parse it 2017-08-29 12:24:09 -05:00
vendor.conf Update containers/storage 2017-12-04 10:14:33 -05:00

README.md

GoDoc Build Status

image is a set of Go libraries aimed at working in various way with containers' images and container image registries.

The containers/image library allows application to pull and push images from container image registries, like the upstream docker registry. It also implements "simple image signing".

The containers/image library also allows you to inspect a repository on a container registry without pulling down the image. This means it fetches the repository's manifest and it is able to show you a docker inspect-like json output about a whole repository or a tag. This library, in contrast to docker inspect, helps you gather useful information about a repository or a tag without requiring you to run docker pull.

The containers/image library also allows you to translate from one image format to another, for example docker container images to OCI images. It also allows you to copy container images between various registries, possibly converting them as necessary, and to sign and verify images.

Command-line usage

The containers/image project is only a library with no user interface; you can either incorporate it into your Go programs, or use the skopeo tool:

The skopeo tool uses the containers/image library and takes advantage of many of its features, e.g. skopeo copy exposes the containers/image/copy.Image functionality.

Dependencies

This library does not ship a committed version of its dependencies in a vendor subdirectory. This is so you can make well-informed decisions about which libraries you should use with this package in your own projects, and because types defined in the vendor directory would be impossible to use from your projects.

What this project tests against dependencies-wise is located in vendor.conf.

Building

If you want to see what the library can do, or an example of how it is called, consider starting with the skopeo tool instead.

To integrate this library into your project, put it into $GOPATH or use your preferred vendoring tool to include a copy in your project. Ensure that the dependencies documented in vendor.conf are also available (using those exact versions or different versions of your choosing).

This library, by default, also depends on the GpgME and libostree C libraries. Either install them:

Fedora$ dnf install gpgme-devel libassuan-devel libostree-devel
macOS$ brew install gpgme

or use the build tags described below to avoid the dependencies (e.g. using go build -tags …)

Supported build tags

  • containers_image_openpgp: Use a Golang-only OpenPGP implementation for signature verification instead of the default cgo/gpgme-based implementation; the primary downside is that creating new signatures with the Golang-only implementation is not supported.
  • containers_image_ostree_stub: Instead of importing ostree: transport in github.com/containers/image/transports/alltransports, use a stub which reports that the transport is not supported. This allows building the library without requiring the libostree development libraries. The github.com/containers/image/ostree package is completely disabled and impossible to import when this build tag is in use.

Contributing

When developing this library, please use make (or make … BUILDTAGS=…) to take advantage of the tests and validation.

License

ASL 2.0

Contact