udock

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: Apache-2.0 Imports: 12 Imported by: 1

README

udock - minimal and simplified docker API

Go Reference

This is a minimal and simplified Docker API that is a bit more friendly to use when your needs are limited. The intended use for this utility is mostly to make it easier to write quick utility functions and tests.

Documentation

Overview

Package udock implements a simplified Docker API.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCreatingDockerClient = errors.New("error creating docker client")
	ErrConnectingToDocker   = errors.New("error connecting to docker")
	ErrListingImages        = errors.New("error listing docker images")
	ErrImageNotPresent      = errors.New("docker image is not present")
	ErrReadingPulledImage   = errors.New("error reading image during pull")
	ErrPullingImage         = errors.New("error pulling image")
	ErrCreatingContainer    = errors.New("error creating container")
	ErrStartingContainer    = errors.New("error starting container")
	ErrTimeout              = errors.New("operation timed out")
	ErrPortMap              = errors.New("portmap error")
)

package errors

Functions

This section is empty.

Types

type Session

type Session struct {
	// contains filtered or unexported fields
}

func Create

func Create() (*Session, error)

func (*Session) Close

func (s *Session) Close() error

Close session.

func (*Session) CreateContainer

func (s *Session) CreateContainer(dockerImage string, containerName string, ports map[string]string) (string, error)

CreateContainer creates a container. If the operation succeeds we return a containerID and error is nil. If an error occurs, the container ID is empty and the error is set.

func (*Session) PullImage

func (s *Session) PullImage(dockerImage string) error

PullImage checks if we have an image and if we do not have the image pulls a docker image. Returns a nil error if ok and an error value if something went wrong.

func (*Session) RemoveContainer

func (s *Session) RemoveContainer(containerID string) error

RemoveContainer removes a container and forces removal of volumes. If the container is running it is shut down first.

func (*Session) RemoveImage

func (s *Session) RemoveImage(dockerImage string) error

RemoveImage removes a docker image.

func (*Session) StartContainer

func (s *Session) StartContainer(containerID string) error

StartContainer starts a docker container that has already been created.

func (*Session) VerifyHaveImage

func (s *Session) VerifyHaveImage(dockerImage string) error

VerifyHaveImage returns a nil error if we have the image and an error if the docker image is missing or an error occurred when probing if we have the image.

Jump to

Keyboard shortcuts

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