docker

package
v0.0.0-...-c54e3d4 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyToContainer

func CopyToContainer(containerId string, path string, contents io.Reader) error

CopyToContainer copies the given contents to the container with containerId

func GetClient

func GetClient() *client.Client

GetClient returns a new docker client created from the current environment the client is created if not already

func RemoveContainer

func RemoveContainer(containerId string, force bool) error

RemoveContainer removes the container with containerId. force allows a running container to be forcefully removed.

func RunCommand

func RunCommand(containerId string, command []string) (string, error)

RunCommand executes the given command with arguments inside the container with containerId

func RunShellCommand

func RunShellCommand(containerId string, command string) (string, error)

RunShellCommand executes the given command string within a /bin/bash shell inside the container with containerId

Types

type Container

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

Container represents a docker container and the operations that can be run on it

func ContainerFromId

func ContainerFromId(id string) *Container

ContainerFromId returns a new Container instance from the given container id

func StartContainer

func StartContainer(image string, entrypoint []string, cmd []string, mounts []mount.Mount) (*Container, error)

StartContainer starts a container with the given image, entrypoint, cmd and host mounts it wraps the container ID in a Container instance and returns it

func (*Container) CopyTo

func (c *Container) CopyTo(path string, contents io.Reader) error

CopyTo copies the given contents to the container

func (*Container) ID

func (c *Container) ID() string

ID returns the current id

func (*Container) Remove

func (c *Container) Remove(force bool) (err error)

Remove removes the container. force allows a running container to be forcefully removed.

func (*Container) RunCommand

func (c *Container) RunCommand(command []string) (output string, err error)

RunCommand executes the given command with arguments inside the container

func (*Container) RunShellCommand

func (c *Container) RunShellCommand(command string) (output string, err error)

RunShellCommand executes the given command string within a /bin/bash shell inside the container

Jump to

Keyboard shortcuts

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