client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileNames

func CompileNames(str string) string

CompileNames regenerate strings to fit compose name standards.

Types

type Client

type Client struct {

	// UsePipes use pipes to communicate with docker compose.
	UsePipes bool
	// contains filtered or unexported fields
}

Client is a docker compose client.

func NewClient

func NewClient(composePath string) (*Client, error)

NewClient create a new docker compose client.

func NewClientWithContext

func NewClientWithContext(ctx context.Context, composePath string) (*Client, error)

NewClientWithContext create a new docker compose client with custom context.

func (*Client) Build

func (c *Client) Build(service string) (*Pipes, error)

Build or rebuild services.

func (*Client) BuildAll

func (c *Client) BuildAll() (*Pipes, error)

BuildAll Build or rebuild services.

func (*Client) Containers

func (c *Client) Containers(all bool) ([]types.Container, error)

Containers gets compose containers

func (*Client) Convert

func (c *Client) Convert() (*Pipes, error)

Convert converts the compose file to platform's canonical format.

func (*Client) Create

func (c *Client) Create(service string) (*Pipes, error)

Create creates container for a service.

func (*Client) CreateAll

func (c *Client) CreateAll() (*Pipes, error)

CreateAll creates containers for a service.

func (*Client) Down

func (c *Client) Down() (*Pipes, error)

Down stops containers and removes containers, networks, volumes, and images created by up.

func (*Client) Events

func (c *Client) Events() (*Pipes, error)

Events displays real time events from containers.

func (*Client) Exec

func (c *Client) Exec(service string, commands ...string) (*Pipes, error)

Exec execute a command in a running container.

func (*Client) Images

func (c *Client) Images() ([]types.ImageSummary, error)

Images lists images used by the created containers.

func (*Client) Kill

func (c *Client) Kill(service string) (*Pipes, error)

Kill stops running container without removing them.

func (*Client) KillAll

func (c *Client) KillAll() (*Pipes, error)

KillAll stops running containers without removing them.

func (*Client) Logs

func (c *Client) Logs(service string) (*Pipes, error)

Logs shows container logs.

func (*Client) LogsAll

func (c *Client) LogsAll() (*Pipes, error)

LogsAll shows all container logs.

func (*Client) LogsAllStream

func (c *Client) LogsAllStream() (*Pipes, error)

LogsAllStream shows all container logs as a stream.

func (*Client) LogsStream

func (c *Client) LogsStream(service string) (*Pipes, error)

LogsStream shows container logs as a stream.

func (*Client) Networks

func (c *Client) Networks() ([]types.NetworkResource, error)

Networks gets compose networks

func (*Client) Pause

func (c *Client) Pause(service string) (*Pipes, error)

Pause pauses container.

func (*Client) PauseAll

func (c *Client) PauseAll() (*Pipes, error)

PauseAll pauses all containers.

func (*Client) Port

func (c *Client) Port(service string) ([]types.Port, error)

Port displays public facing port of the container.

func (*Client) Ps

func (c *Client) Ps() ([]types.Container, error)

Ps lists running containers.

func (*Client) PsAll

func (c *Client) PsAll() ([]types.Container, error)

PsAll lists all containers.

func (*Client) Restart

func (c *Client) Restart(service string) (*Pipes, error)

Restart restart service container.

func (*Client) RestartAll

func (c *Client) RestartAll() (*Pipes, error)

RestartAll restart service containers.

func (*Client) Rm

func (c *Client) Rm(service string) (*Pipes, error)

Rm removes stopped service containers.

func (*Client) RmAll

func (c *Client) RmAll() (*Pipes, error)

RmAll removes all service containers.

func (*Client) Run

func (c *Client) Run(service string, commands ...string) (*Pipes, error)

Run a one-off command on a service.

func (*Client) Start

func (c *Client) Start(service string) (*Pipes, error)

Start service container.

func (*Client) StartAll

func (c *Client) StartAll() (*Pipes, error)

StartAll start all service containers.

func (*Client) Stop

func (c *Client) Stop(service string) (*Pipes, error)

Stop service container.

func (*Client) StopAll

func (c *Client) StopAll() (*Pipes, error)

StopAll stop all service containers.

func (*Client) Top added in v1.0.0

func (c *Client) Top(service string) (*Pipes, error)

Top lists processes running inside a container.

func (*Client) TopAll added in v1.0.0

func (c *Client) TopAll() (*Pipes, error)

TopAll lists processes running inside all containers.

func (*Client) Unpause

func (c *Client) Unpause(service string) (*Pipes, error)

Unpause unpauses container.

func (*Client) UnpauseAll

func (c *Client) UnpauseAll() (*Pipes, error)

UnpauseAll unpauses all containers.

func (*Client) Up

func (c *Client) Up() (*Pipes, error)

Up create and start containers.

func (*Client) Volumes

func (c *Client) Volumes() ([]*types.Volume, error)

Volumes gets compose volumes

func (*Client) Wait

func (c *Client) Wait()

Wait until all working processes completed.

type Pipes added in v0.2.0

type Pipes struct {
	Stdin  io.WriteCloser
	Stdout io.ReadCloser
	Stderr io.ReadCloser
}

Pipes is a struct that holds the pipes of a command.

func (*Pipes) Close added in v0.2.0

func (p *Pipes) Close() error

Close closes the pipes.

func (*Pipes) StderrBytes added in v0.2.0

func (p *Pipes) StderrBytes() []byte

StderrBytes reads all bytes from stderr pipe.

func (*Pipes) StderrString added in v0.2.0

func (p *Pipes) StderrString() string

StderrString reads all bytes from stderr pipe and convert string.

func (*Pipes) StdoutBytes added in v0.2.0

func (p *Pipes) StdoutBytes() []byte

StdoutBytes reads all bytes from stdout pipe.

func (*Pipes) StdoutString added in v0.2.0

func (p *Pipes) StdoutString() string

StdoutString reads all bytes from stdout pipe and convert string.

func (*Pipes) String added in v0.2.0

func (p *Pipes) String() string

String returns a string representation of the pipes.

Jump to

Keyboard shortcuts

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