Documentation ¶
Overview ¶
The package image provides libraries and commands to interact with container images.
package main import ( "context" "fmt" "github.com/containers/image/v5/docker" ) func main() { ref, err := docker.ParseReference("//fedora") if err != nil { panic(err) } ctx := context.Background() img, err := ref.NewImage(ctx, nil) if err != nil { panic(err) } defer img.Close() b, _, err := img.Manifest(ctx) if err != nil { panic(err) } fmt.Printf("%s", string(b)) }
## Notes on running in rootless mode
If your application needs to access a containers/storage store in rootless mode, then the following additional steps have to be performed at start-up of your application:
package main import ( "github.com/containers/storage/pkg/reexec" "github.com/syndtr/gocapability/capability" "github.com/containers/storage/pkg/unshare" ) var neededCapabilities = []capability.Cap{ capability.CAP_CHOWN, capability.CAP_DAC_OVERRIDE, capability.CAP_FOWNER, capability.CAP_FSETID, capability.CAP_MKNOD, capability.CAP_SETFCAP, } func main() { reexec.Init() capabilities, err := capability.NewPid(0) if err != nil { panic(err) } for _, cap := range neededCapabilities { if !capabilities.Get(capability.EFFECTIVE, cap) { // We miss a capability we need, create a user namespaces unshare.MaybeReexecUsingUserNamespace(true) } } // rest of your code follows here }
TODO(runcom)
Directories ¶
Path | Synopsis |
---|---|
reference
Package reference provides a general type to represent any way of referencing images within the registry.
|
Package reference provides a general type to represent any way of referencing images within the registry. |
tarfile
Package tarfile is an internal implementation detail of some transports.
|
Package tarfile is an internal implementation detail of some transports. |
Package image consolidates knowledge about various container image formats (as opposed to image storage mechanisms, which are handled by types.ImageSource) and exposes all of them using an unified interface.
|
Package image consolidates knowledge about various container image formats (as opposed to image storage mechanisms, which are handled by types.ImageSource) and exposes all of them using an unified interface. |
internal
|
|
image
Package image consolidates knowledge about various container image formats (as opposed to image storage mechanisms, which are handled by types.ImageSource) and exposes all of them using an unified interface.
|
Package image consolidates knowledge about various container image formats (as opposed to image storage mechanisms, which are handled by types.ImageSource) and exposes all of them using an unified interface. |
imagedestination/stubs
Package stubs contains trivial stubs for parts of private.ImageDestination.
|
Package stubs contains trivial stubs for parts of private.ImageDestination. |
imagesource/stubs
Package stubs contains trivial stubs for parts of private.ImageSource.
|
Package stubs contains trivial stubs for parts of private.ImageSource. |
testing/explicitfilepath-tmpdir
Package tmpdir is a TESTING-ONLY utility.
|
Package tmpdir is a TESTING-ONLY utility. |
pkg
|
|
blobinfocache/boltdb
Package boltdb implements a BlobInfoCache backed by BoltDB.
|
Package boltdb implements a BlobInfoCache backed by BoltDB. |
blobinfocache/internal/prioritize
Package prioritize provides utilities for prioritizing locations in types.BlobInfoCache.CandidateLocations.
|
Package prioritize provides utilities for prioritizing locations in types.BlobInfoCache.CandidateLocations. |
blobinfocache/internal/test
Package test provides generic BlobInfoCache test helpers.
|
Package test provides generic BlobInfoCache test helpers. |
blobinfocache/memory
Package memory implements an in-memory BlobInfoCache.
|
Package memory implements an in-memory BlobInfoCache. |
blobinfocache/none
Package none implements a dummy BlobInfoCache which records no data.
|
Package none implements a dummy BlobInfoCache which records no data. |
blobinfocache/sqlite
Package boltdb implements a BlobInfoCache backed by SQLite.
|
Package boltdb implements a BlobInfoCache backed by SQLite. |
Package tarball provides a way to generate images using one or more layer tarballs and an optional template configuration.
|
Package tarball provides a way to generate images using one or more layer tarballs and an optional template configuration. |
Click to show internal directories.
Click to hide internal directories.