kind: Index | Files

package docker

import ""

Package docker contains helpers for working with docker This package has no stability guarantees whatsoever!

Package docker contains helpers for working with docker This package has no stability guarantees whatsoever!


Package Files

archive.go doc.go exec.go image.go pull.go run.go save.go

func ContainerCmder Uses

func ContainerCmder(containerNameOrID string) exec.Cmder

ContainerCmder creates a new exec.Cmder against a docker container

func EditArchiveRepositories Uses

func EditArchiveRepositories(reader io.Reader, writer io.Writer, editRepositories func(string) string) error

EditArchiveRepositories applies edit to reader's image repositories, IE the repository part of repository:tag in image tags This supports v1 / v1.1 / v1.2 Docker Image Archives

editRepositories should be a function that returns the input or an edited form, where the input is the image repository

func GetArchiveTags Uses

func GetArchiveTags(path string) ([]string, error)

GetArchiveTags obtains a list of "repo:tag" docker image tags from a given docker image archive (tarball) path compatible with all known specs:

func ImageID Uses

func ImageID(containerNameOrID string) (string, error)

ImageID return the Id of the container image

func ImageInspect Uses

func ImageInspect(containerNameOrID, format string) ([]string, error)

ImageInspect return low-level information on containers images

func Pull Uses

func Pull(logger log.Logger, image string, retries int) error

Pull pulls an image, retrying up to retries times

func PullIfNotPresent Uses

func PullIfNotPresent(logger log.Logger, image string, retries int) (pulled bool, err error)

PullIfNotPresent will pull an image if it is not present locally retrying up to retries times it returns true if it attempted to pull, and any errors from pulling

func Run Uses

func Run(image string, runArgs []string, containerArgs []string) error

Run creates a container with "docker run", with some error handling

func Save Uses

func Save(image, dest string) error

Save saves image to dest, as in `docker save`

func SplitImage Uses

func SplitImage(image string) (registry, tag string, err error)

SplitImage splits an image into (registry,tag) following these cases:

alpine -> (alpine, latest)

alpine:latest -> (alpine, latest)

alpine@sha256:28ef97b8686a0b5399129e9b763d5b7e5ff03576aa5580d6f4182a49c5fe1913 -> (alpine, latest@sha256:28ef97b8686a0b5399129e9b763d5b7e5ff03576aa5580d6f4182a49c5fe1913)

alpine:latest@sha256:28ef97b8686a0b5399129e9b763d5b7e5ff03576aa5580d6f4182a49c5fe1913 -> (alpine, latest@sha256:28ef97b8686a0b5399129e9b763d5b7e5ff03576aa5580d6f4182a49c5fe1913)

NOTE: for our purposes we consider the sha to be part of the tag, and we resolve the implicit :latest

Package docker imports 12 packages (graph) and is imported by 1 packages. Updated 2020-06-30. Refresh now. Tools for package owners.