docker

package module
v0.0.0-...-bccfbee Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: MIT Imports: 16 Imported by: 0

README

golang-docker-client

This is a client microbox uses for microagent as well as microbox local

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerExecResize

func ContainerExecResize(id string, height, width int) error

resize the exec.

func ContainerInspect

func ContainerInspect(id string) (dockType.ContainerJSON, error)

ContainerInspect

func ContainerList

func ContainerList() ([]dockType.Container, error)

ContainerList

func ContainerRemove

func ContainerRemove(id string) error

ContainerRemove

func ContainerStart

func ContainerStart(id string) error

Start a container. If the container is already running this will error.

func ContainerStats

func ContainerStats(id string) (dockType.Stats, error)

ContainerStats(ctx context.Context, containerID string, stream bool) (io.ReadCloser, error)

func ContainerStop

func ContainerStop(id string) error

give them 5 seconds.. todo maybe make it adjustable

func CreateContainer

func CreateContainer(conf ContainerConfig) (dockType.ContainerJSON, error)

create a container from the user specification

func ExecInspect

func ExecInspect(id string) (dockType.ContainerExecInspect, error)

func ExecPipe

func ExecPipe(resp dockType.HijackedResponse, inStream io.Reader, outStream, errorStream io.Writer) error

func GetContainer

func GetContainer(name string) (dockType.ContainerJSON, error)

GetContainer

func GetIP

func GetIP(i interface{}) (ip string)

func ImageExists

func ImageExists(name string) bool

ImageExists

func ImageRemove

func ImageRemove(imageID string, force bool) error

func Initialize

func Initialize(host string) error

func VolumeCreate

func VolumeCreate(name string) (dockType.Volume, error)

create a new volume

func VolumeExists

func VolumeExists(name string) bool

check to see if a volume exists

func VolumeList

func VolumeList() ([]*dockType.Volume, error)

list the volumes we have

func VolumeRemove

func VolumeRemove(name string) error

remove an existing volume

Types

type ContainerConfig

type ContainerConfig struct {
	ID              string            `json:"id"`
	Network         string            `json:"network"`
	NetName         string            `json:"networkname"`
	Name            string            `json:"name"`
	Labels          map[string]string `json:"labels"`
	Hostname        string            `json:"hostname"`
	Domainname      string            `json:"domainname"`
	Cmd             []string          `json:"cmd"`
	Env             []string          `json:"env"`
	Image           string            `json:"image_slug"`
	IP              string            `json:"ip"`
	Binds           []string          `json:"binds"`
	Memory          int64             `json:"memory"`
	MemorySwap      int64             `json:"memory_swap"`
	Status          string            `json:"status"`
	CPUShares       int64             `json:"cpu_shares"`
	RestartPolicy   string            `json:"restart_policy"`
	RestartAttempts int               `json:"restart_attempts"`
	Ports           []string          `json:"ports"`
}

func ContainerJSONtoConfig

func ContainerJSONtoConfig(cj dockType.ContainerJSON) ContainerConfig

func ContainerSliceToConfigSlice

func ContainerSliceToConfigSlice(cs []dockType.Container) []ContainerConfig

type ExecConfig

type ExecConfig struct {
	ID                         string
	User                       string
	Cmd                        []string
	Env                        []string
	Stdin, Stdout, Stderr, Tty bool
}

type Image

type Image struct {
	ID          string   `json:"id"`
	Slug        string   `json:"slug"`
	RepoTags    []string `json:"repo_tags"`
	Size        int64    `json:"size"`
	VirtualSize int64    `json:"virtual_size"`
	Status      string   `json:"status"`
}

func ImageInspect

func ImageInspect(imageID string) (Image, error)

func ImageList

func ImageList() ([]Image, error)

list the images i have cached on the server

func ImagePull

func ImagePull(image string, output io.Writer) (Image, error)

pull any new image

Jump to

Keyboard shortcuts

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