container

package
v0.0.0-...-02c76fb Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const (

	// DefaultNetworkMode is the mode of the container network
	DefaultNetworkMode = "default"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	// the name of the container
	Name string `export:"name"`

	// the name of the image
	Image string `export:"image"`

	// the entrypoint into the container
	Entrypoint []string `export:"entrypoint"`

	// the command to run
	Command []string `export:"command"`

	// the working directory
	WorkingDir string `export:"workingdir"`

	// configured environment variables for the container
	Env []string `export:"env"`

	// additional ports to exposed in the container
	Expose []string `export:"expose"`

	// A list of links for the container in the form of container_name:alias
	Links []string `export:"links"`

	// ports to bind
	PortBindings []string `export:"portbindings"`

	// list of DNS servers the container is using
	DNS []string `export:"dns"`

	// volumes that have been bind-mounted
	Volumes []string `export:"volumes"`

	// containers from which volumes have been mounted
	VolumesFrom []string `export:"volumesfrom"`

	// if true, all ports have been published
	PublishAllPorts bool `export:"publishallports"`

	// the mode of the container network
	NetworkMode string `export:"networkmode"`

	// networks the container is connected to
	Networks []string `export:"networks"`

	// the status of the container.
	CStatus string `export:"status"`

	// Indicate whether the 'force' flag was set
	Force bool `export:"force"`
	// contains filtered or unexported fields
}

Container is responsible for creating docker containers

func (*Container) Apply

Apply starts a docker container with the specified configuration

func (*Container) Check

Check that a docker container with the specified configuration exists

func (*Container) SetClient

func (c *Container) SetClient(client docker.APIClient)

SetClient injects a docker api client

type Preparer

type Preparer struct {
	// name of the container
	Name string `hcl:"name" required:"true" nonempty:"true"`

	// the image name or ID to use for the container
	Image string `hcl:"image" required:"true" nonempty:"true"`

	// override the container entrypoint
	Entrypoint []string `hcl:"entrypoint"`

	// override the container command
	Command []string `hcl:"command"`

	// override the working directory of the container
	WorkingDir string `hcl:"working_dir" nonempty:"true"`

	// set environment variables in the container
	Env map[string]string `hcl:"env"`

	// additional ports to expose in the container
	Expose []string `hcl:"expose"`

	// A list of links for the container. Each link entry should be in the form of
	// container_name:alias
	Links []string `hcl:"links"`

	// publish container ports to the host. Each item should be in the following
	// format:
	// ip:hostPort:containerPort|ip::containerPort|hostPort:containerPort|containerPort.
	// Ports can be specified in the format: portnum/proto. If proto is not
	// specified, "tcp" is assumed
	Ports []string `hcl:"ports"`

	// list of DNS servers for the container to use
	DNS []string `hcl:"dns"`

	// the mode of the container network. default: default
	NetworkMode string `hcl:"network_mode"`

	// the networks to connect the container to
	Networks []string `hcl:"networks"`

	// bind mounts volumes
	Volumes []string `hcl:"volumes"`

	// mounts all volumes from the specified container
	VolumesFrom []string `hcl:"volumes_from"`

	// allocates a random host port for all of a container’s exposed ports.
	// Specified as a boolean value
	PublishAllPorts bool `hcl:"publish_all_ports"`

	// the desired status of the container.
	Status string `hcl:"status" valid_values:"running,created"`

	// indicates whether or not the container will be recreated if the state is
	// not what is expected. By default, the module will only check to see if the
	// container exists. Specified as a boolean value
	Force bool `hcl:"force"`
}

Preparer for docker containers

Container is responsible for creating docker containers. It assumes that there is already a Docker daemon running on the system. *Note: docker resources are not currently supported on Solaris.*

func (*Preparer) Prepare

func (p *Preparer) Prepare(ctx context.Context, render resource.Renderer) (resource.Task, error)

Prepare a docker container

Jump to

Keyboard shortcuts

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