converge: github.com/asteris-llc/converge/resource/docker/container Index | Files

package container

import "github.com/asteris-llc/converge/resource/docker/container"

Index

Package Files

container.go preparer.go

Constants

const (

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

type Container Uses

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 Uses

func (c *Container) Apply(context.Context) (resource.TaskStatus, error)

Apply starts a docker container with the specified configuration

func (*Container) Check Uses

func (c *Container) Check(context.Context, resource.Renderer) (resource.TaskStatus, error)

Check that a docker container with the specified configuration exists

func (*Container) SetClient Uses

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

SetClient injects a docker api client

type Preparer Uses

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 Uses

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

Prepare a docker container

Package container imports 13 packages (graph) and is imported by 2 packages. Updated 2017-01-20. Refresh now. Tools for package owners.