Work with containers' images
Go to file
Miloslav Trmač a56436cb15 Use testing.T.Setenv instead of os.Setenv in tests
... to simplify and benefit from Go 1.17.

In some cases, wrap tests in testing.T.Run() to decrease
the scope, or to make the relationship between the test and the
cleanup clearer.  In some cases it's still a bit awkward
because there is no testing.T.Unsetenv, but still worth it.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-06-14 20:57:04 +02:00
.github Upgrade to GitHub-native Dependabot 2021-05-01 07:18:32 -04:00
contrib/cirrus Cirrus: Update to F36 VMs 2022-04-29 14:29:16 -04:00
copy Use testing.T.Setenv instead of os.Setenv in tests 2022-06-14 20:57:04 +02:00
directory Add image.FromReference, replace most users of image.FromSource 2022-06-11 01:25:44 +02:00
docker Stop using net/tls.Config.PreferServerCipherSuites 2022-06-14 18:40:25 +02:00
docs Fix codespell errors 2022-05-25 06:18:36 -04:00
hack build(deps): bump github.com/containers/storage from 1.33.1 to 1.33.2 2021-08-09 16:48:13 +02:00
image Move c/image/image to c/image/internal/image 2022-06-11 01:25:43 +02:00
internal Introduce mocks.ForbiddenUnparsedImage, use it to simplify tests 2022-06-13 23:53:56 +02:00
manifest Move c/image/image to c/image/internal/image 2022-06-11 01:25:43 +02:00
oci Add image.FromReference, replace most users of image.FromSource 2022-06-11 01:25:44 +02:00
openshift Use testing.T.Setenv instead of os.Setenv in tests 2022-06-14 20:57:04 +02:00
ostree Add image.FromReference, replace most users of image.FromSource 2022-06-11 01:25:44 +02:00
pkg Use testing.T.Setenv instead of os.Setenv in tests 2022-06-14 20:57:04 +02:00
sif Add image.FromReference, replace most users of image.FromSource 2022-06-11 01:25:44 +02:00
signature Use testing.T.Setenv instead of os.Setenv in tests 2022-06-14 20:57:04 +02:00
storage Move all internal users of image/v5/image to image/v5/internal/image 2022-06-11 01:25:44 +02:00
tarball Add image.FromReference, replace most users of image.FromSource 2022-06-11 01:25:44 +02:00
transports Allow building the SIF transport on non-Linux systems 2022-01-12 23:51:01 +01:00
types shortnames: mechanism to enforce resolving to Docker Hub 2021-11-29 11:27:15 +01:00
version Move to v5.21.2-dev 2022-05-02 20:40:36 +02:00
.cirrus.Dockerfile Cirrus: Migrate from Travis CI 2021-03-11 11:20:18 +01:00
.cirrus.yml Cirrus: use Ubuntu 22.04 LTS 2022-05-27 10:56:43 -04:00
.gitignore Issue #475 Add flag for image compress layer for oci destination 2018-07-12 17:50:17 +05:30
.golangci.yml Enable Cirrus validation tests 2019-12-04 11:01:17 +01:00
.pullapprove.yml *: add pullapprove 2016-06-27 16:34:59 +02:00
CODE-OF-CONDUCT.md Fix docs links due to branch rename 2021-06-10 11:23:41 -04:00
CONTRIBUTING.md one commit 2021-04-06 21:50:49 -04:00
LICENSE Move to Apache 2 license 2016-06-24 11:35:34 -07:00
MAINTAINERS add @vrothberg to the list of MAINTAINERS 2019-01-11 16:33:51 +01:00
Makefile Stop calling gpgme-config 2022-05-19 21:42:40 +02:00
README.md Change all references to docker registry to container registry 2021-06-30 15:34:06 -04:00
SECURITY.md Fix docs links due to branch rename 2021-06-10 11:23:41 -04:00
doc.go Add simple documentation how to use c/image with podman's rootless mode 2021-11-11 08:06:50 +01:00
go.mod Update go.mod to Go 1.17 2022-06-14 18:40:25 +02:00
go.sum build(deps): bump github.com/docker/docker 2022-06-07 08:19:14 +00:00
registries.conf Enable subdomain matching in registries.conf 2021-04-09 11:33:56 -04: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 docker.io and quay.io registries. 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 ships as a Go module.

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, include it as a Go module, put it into $GOPATH or use your preferred vendoring tool to include a copy in your project. Ensure that the dependencies documented in go.mod 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 ostree-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: Import ostree: transport in github.com/containers/image/transports/alltransports. This builds the library requiring the libostree development libraries. Otherwise a stub which reports that the transport is not supported gets used. The github.com/containers/image/ostree package is completely disabled and impossible to import when this build tag is not in use.

Contributing

Information about contributing to this project.

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

License

Apache License 2.0

SPDX-License-Identifier: Apache-2.0

Contact