Documentation ¶
Index ¶
- func Connect(dockerEndpoint string, cfg *Config) (*Builder, *ContainerBackend, error)
- type Authenticator
- type Builder
- func (b *Builder) BuildClientImage(ctx context.Context, client libhive.ClientDesignator) (string, error)
- func (b *Builder) BuildImage(ctx context.Context, name string, fsys fs.FS) error
- func (b *Builder) BuildSimulatorImage(ctx context.Context, name string) (string, error)
- func (b *Builder) ReadFile(ctx context.Context, image, path string) ([]byte, error)
- type Config
- type ContainerBackend
- func (cb *ContainerBackend) Build(ctx context.Context, b libhive.Builder) error
- func (b *ContainerBackend) ConnectContainer(containerID, networkID string) error
- func (b *ContainerBackend) ContainerIP(containerID, networkID string) (net.IP, error)
- func (b *ContainerBackend) CreateContainer(ctx context.Context, imageName string, opt libhive.ContainerOptions) (string, error)
- func (b *ContainerBackend) CreateNetwork(name string) (string, error)
- func (b *ContainerBackend) DeleteContainer(containerID string) error
- func (b *ContainerBackend) DisconnectContainer(containerID, networkID string) error
- func (b *ContainerBackend) NetworkNameToID(name string) (string, error)
- func (b *ContainerBackend) PauseContainer(containerID string) error
- func (b *ContainerBackend) RemoveNetwork(id string) error
- func (b *ContainerBackend) RunProgram(ctx context.Context, containerID string, cmd []string) (*libhive.ExecInfo, error)
- func (cb *ContainerBackend) ServeAPI(ctx context.Context, h http.Handler) (libhive.APIServer, error)
- func (b *ContainerBackend) StartContainer(ctx context.Context, containerID string, opt libhive.ContainerOptions) (*libhive.ContainerInfo, error)
- func (b *ContainerBackend) UnpauseContainer(containerID string) error
- type CredHelperAuthenticator
- type CredHelpers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Authenticator ¶
type Authenticator interface { // AuthConfigs returns the auth configurations for all configured registries. AuthConfigs() docker.AuthConfigurations }
Authenticator holds the configuration for docker registry authentication.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder takes care of building docker images.
func NewBuilder ¶
func NewBuilder(client *docker.Client, cfg *Config, auth Authenticator) *Builder
func (*Builder) BuildClientImage ¶
func (b *Builder) BuildClientImage(ctx context.Context, client libhive.ClientDesignator) (string, error)
BuildClientImage builds a docker image of the given client.
func (*Builder) BuildImage ¶
BuildImage creates a container by archiving the given file system, which must contain a file called "Dockerfile".
func (*Builder) BuildSimulatorImage ¶
BuildSimulatorImage builds a docker image of a simulator.
type Config ¶
type Config struct { Inventory libhive.Inventory Logger log15.Logger // When building containers, any client or simulator image build matching the pattern // will avoid the docker cache. NoCachePattern *regexp.Regexp // This forces pulling of base images when building clients and simulators. PullEnabled bool // These two are log destinations for output from docker. ContainerOutput io.Writer BuildOutput io.Writer // This tells the docker client whether to authenticate requests with credential helper UseCredentialHelper bool }
Config is the configuration of the docker backend.
type ContainerBackend ¶
type ContainerBackend struct {
// contains filtered or unexported fields
}
func NewContainerBackend ¶
func NewContainerBackend(c *docker.Client, cfg *Config) *ContainerBackend
func (*ContainerBackend) ConnectContainer ¶
func (b *ContainerBackend) ConnectContainer(containerID, networkID string) error
ConnectContainer connects the given container to a network.
func (*ContainerBackend) ContainerIP ¶
func (b *ContainerBackend) ContainerIP(containerID, networkID string) (net.IP, error)
ContainerIP finds the IP of a container in the given network.
func (*ContainerBackend) CreateContainer ¶
func (b *ContainerBackend) CreateContainer(ctx context.Context, imageName string, opt libhive.ContainerOptions) (string, error)
CreateContainer creates a docker container.
func (*ContainerBackend) CreateNetwork ¶
func (b *ContainerBackend) CreateNetwork(name string) (string, error)
CreateNetwork creates a docker network.
func (*ContainerBackend) DeleteContainer ¶
func (b *ContainerBackend) DeleteContainer(containerID string) error
DeleteContainer removes the given container. If the container is running, it is stopped.
func (*ContainerBackend) DisconnectContainer ¶
func (b *ContainerBackend) DisconnectContainer(containerID, networkID string) error
DisconnectContainer disconnects the given container from a network.
func (*ContainerBackend) NetworkNameToID ¶
func (b *ContainerBackend) NetworkNameToID(name string) (string, error)
NetworkNameToID finds the network ID of network by the given name.
func (*ContainerBackend) PauseContainer ¶
func (b *ContainerBackend) PauseContainer(containerID string) error
PauseContainer pauses the given container.
func (*ContainerBackend) RemoveNetwork ¶
func (b *ContainerBackend) RemoveNetwork(id string) error
RemoveNetwork deletes a docker network.
func (*ContainerBackend) RunProgram ¶
func (b *ContainerBackend) RunProgram(ctx context.Context, containerID string, cmd []string) (*libhive.ExecInfo, error)
RunProgram runs a /hive-bin script in a container.
func (*ContainerBackend) ServeAPI ¶
func (cb *ContainerBackend) ServeAPI(ctx context.Context, h http.Handler) (libhive.APIServer, error)
ServeAPI starts the API server.
func (*ContainerBackend) StartContainer ¶
func (b *ContainerBackend) StartContainer(ctx context.Context, containerID string, opt libhive.ContainerOptions) (*libhive.ContainerInfo, error)
StartContainer starts a docker container.
func (*ContainerBackend) UnpauseContainer ¶
func (b *ContainerBackend) UnpauseContainer(containerID string) error
UnpauseContainer unpauses the given container.
type CredHelperAuthenticator ¶
type CredHelperAuthenticator struct {
// contains filtered or unexported fields
}
func NewCredHelperAuthenticator ¶
func NewCredHelperAuthenticator() (CredHelperAuthenticator, error)
func (CredHelperAuthenticator) AuthConfigs ¶
func (c CredHelperAuthenticator) AuthConfigs() (a docker.AuthConfigurations)
AuthConfigs returns the auth configurations for all configured registries
type CredHelpers ¶
type CredHelpers struct { CredHelpers map[string]string `json:"credHelpers"` CredsStore string `json:"credsStore"` }
CredHelpers represents the data stored by default in $HOME/.docker/config.json