docker

package
v0.0.0-...-df593d5 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 12 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 ConnectNetwork

func ConnectNetwork(container, network string) error

ConnectNetwork connects network to container.

func ConnectNetworkWithAlias

func ConnectNetworkWithAlias(container, network, alias string) error

ConnectNetworkWithAlias connects network to container adding a network-scoped alias for the container.

func ContainerCmder

func ContainerCmder(containerNameOrID string) exec.Cmder

ContainerCmder creates a new exec.Cmder against a docker container

func CopyFrom

func CopyFrom(containerNameOrID, srcPath, hostPath string) error

CopyFrom copies the file or dir in the container at srcPath to the host at hostPath

func CopyTo

func CopyTo(hostPath, containerNameOrID, destPath string) error

CopyTo copies the file at hostPath to the container at destPath

func Create

func Create(image string, runArgs []string, containerArgs []string) (id string, err error)

Create creates a container with "docker create", with some error handling it will return the ID of the created container if any, even on error

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.0.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 Inspect

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

Inspect return low-level information on containers

func InspectObject

func InspectObject(containerNameOrID, format string, out interface{}) error

InspectObject is similar to Inspect but deserializes the JSON output to a struct.

func IsRunning

func IsRunning() error

IsRunning checks if Docker is running properly

func Kill

func Kill(signal, containerNameOrID string) error

Kill sends the named signal to the container

func Pull

func Pull(image string, retries int) error

Pull pulls an image, retrying up to retries times

func PullIfNotPresent

func PullIfNotPresent(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

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

Run creates a container with "docker run", with some error handling it will return the ID of the created container if any, even on error

func Save

func Save(image, dest string) error

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

func Start

func Start(container string) error

Start starts a container.

func Stop

func Stop(container string) error

Stop stops a container.

func UsernsRemap

func UsernsRemap() bool

UsernsRemap checks if userns-remap is enabled in dockerd

Types

This section is empty.

Jump to

Keyboard shortcuts

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