container

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context, clientInstance client.ContainerAPIClient, id string) (*types.ContainerJSON, error)

Get looks up the hosts containers with the specified ID or name and returns it, or an error.

func ListByFilter

func ListByFilter(ctx context.Context, clientInstance client.ContainerAPIClient, containerFilters ...map[string][]string) ([]types.Container, error)

ListByFilter looks up the hosts containers with the specified filters and returns a list of container matching it, or an error.

Types

type Container

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

Container holds information about a docker container and the service it is tied on.

func Create

func Create(ctx context.Context, client client.ContainerAPIClient, name string, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig) (*Container, error)

Create creates a container and return a Container struct (and an error if any)

func New

New creates a container struct with the specified client, id and name

func NewInspected

func NewInspected(client client.ContainerAPIClient, container *types.ContainerJSON) *Container

NewInspected creates a container struct from an inspected container

func (*Container) Hash

func (c *Container) Hash() string

Hash returns the container hash stored as label.

func (*Container) ID

func (c *Container) ID() string

ID returns the container Id.

func (*Container) Image

func (c *Container) Image() string

Image returns the container image. Depending on the engine version its either the complete id or the digest reference the image.

func (*Container) ImageConfig

func (c *Container) ImageConfig() string

ImageConfig returns the container image stored in the config. It's the human-readable name of the image.

func (*Container) Info

func (c *Container) Info(ctx context.Context) (project.Info, error)

Info returns info about the container, like name, command, state or ports.

func (*Container) IsRunning

func (c *Container) IsRunning(ctx context.Context) bool

IsRunning returns the running state of the container.

func (*Container) Kill

func (c *Container) Kill(ctx context.Context, signal string) error

Kill kill the container.

func (*Container) Log

func (c *Container) Log(ctx context.Context, l logger.Logger, follow bool) error

Log forwards container logs to the project configured logger.

func (*Container) Name

func (c *Container) Name() string

Name returns the container name.

func (*Container) Networks

func (c *Container) Networks() (map[string]*network.EndpointSettings, error)

Networks returns the containers network

func (*Container) Number

func (c *Container) Number() (int, error)

Number returns the container number stored as label.

func (*Container) Pause

func (c *Container) Pause(ctx context.Context) error

Pause pauses the container. If the containers are already paused, don't fail.

func (*Container) Port

func (c *Container) Port(ctx context.Context, port string) (string, error)

Port returns the host port the specified port is mapped on.

func (*Container) Remove

func (c *Container) Remove(ctx context.Context, removeVolume bool) error

Remove removes the container.

func (*Container) Rename

func (c *Container) Rename(ctx context.Context, newName string) error

Rename rename the container.

func (*Container) Restart

func (c *Container) Restart(ctx context.Context, timeout int) error

Restart restarts the container if existing, does nothing otherwise.

func (*Container) Run

func (c *Container) Run(ctx context.Context, configOverride *config.ServiceConfig) (int, error)

Run creates, start and attach to the container based on the image name, the specified configuration. It will always create a new container.

func (*Container) ShortID added in v0.5.0

func (c *Container) ShortID() string

ShortID return the container Id in its short form

func (*Container) Start

func (c *Container) Start(ctx context.Context) error

Start the specified container with the specified host config

func (*Container) Stop

func (c *Container) Stop(ctx context.Context, timeout int) error

Stop stops the container.

func (*Container) Unpause

func (c *Container) Unpause(ctx context.Context) error

Unpause unpauses the container. If the containers are not paused, don't fail.

Jump to

Keyboard shortcuts

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