libcompose: github.com/docker/libcompose/docker/container Index | Files

package container

import "github.com/docker/libcompose/docker/container"

Index

Package Files

container.go functions.go

func Get Uses

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 Uses

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.

type Container Uses

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

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

func Create Uses

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 Uses

func New(ctx context.Context, client client.ContainerAPIClient, id string) (*Container, error)

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

func NewInspected Uses

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

NewInspected creates a container struct from an inspected container

func (*Container) Hash Uses

func (c *Container) Hash() string

Hash returns the container hash stored as label.

func (*Container) ID Uses

func (c *Container) ID() string

ID returns the container Id.

func (*Container) Image Uses

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 Uses

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 Uses

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 Uses

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

IsRunning returns the running state of the container.

func (*Container) Kill Uses

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

Kill kill the container.

func (*Container) Log Uses

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 Uses

func (c *Container) Name() string

Name returns the container name.

func (*Container) Networks Uses

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

Networks returns the containers network

func (*Container) Number Uses

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

Number returns the container number stored as label.

func (*Container) Pause Uses

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

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

func (*Container) Port Uses

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 Uses

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

Remove removes the container.

func (*Container) Rename Uses

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

Rename rename the container.

func (*Container) Restart Uses

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

Restart restarts the container if existing, does nothing otherwise.

func (*Container) Run Uses

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 Uses

func (c *Container) ShortID() string

ShortID return the container Id in its short form

func (*Container) Start Uses

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

Start the specified container with the specified host config

func (*Container) Stop Uses

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

Stop stops the container.

func (*Container) Unpause Uses

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

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

Package container imports 21 packages (graph) and is imported by 5 packages. Updated 2017-10-27. Refresh now. Tools for package owners.