docker

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

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!

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerCmder

func ContainerCmder(containerNameOrID string) exec.Cmder

ContainerCmder creates a new exec.Cmder against a docker container

func GetArchiveTags

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: https://github.com/moby/moby/blob/master/image/spec/v1.md https://github.com/moby/moby/blob/master/image/spec/v1.1.md https://github.com/moby/moby/blob/master/image/spec/v1.2.md

func ImageID

func ImageID(containerNameOrID string) (string, error)

ImageID return the Id of the container image

func ImageInspect

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

ImageInspect return low-level information on containers images

func Pull

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

Pull pulls an image, retrying up to retries times

func Run

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

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

func Save

func Save(image, dest string) error

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

func SplitImage

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

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL