docker

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

README

** Docker service**

Service Id Action Description Request Response
docker run run requested docker service RunRequest ContainerInfo
docker images check docker image ImagesRequest ImagesResponse
docker stop-images stop docker containers matching specified images StopImagesRequest StopImagesResponse
docker pull pull requested docker image PullRequest ImageInfo
docker process check docker container processes ContainerCheckRequest ContainerCheckResponse
docker start start specified docker container ContainerStartRequest ContainerInfo
docker exec run command within specified docker container ContainerRunCommandRequest ContainerRunCommandResponse
docker stop stop specified docker container ContainerStopRequest ContainerInfo
docker remove remove specified docker container ContainerRemoveRequest ContainerRemoveResponse
docker logs fetch container logs (app stdout/stderr) ContainerLogsRequest ContainerLogsResponse
docker inspect inspect supplied instance name InspectRequest InspectResponse
docker build build docker image BuildRequest BuildResponse
docker tag create a target image that referes to source docker image BuildRequest BuildResponse
docker login store supplied credentials for provided repository in local docker store LoginRequest LoginResponse
docker logout remove credentials for supplied repository LogoutRequest LogoutResponse
docker push copy image to supplied repository PushRequest PushResponse
docker composeUp docker compose up ComposeUpRequest ComposeResponse
docker comoseDown docker compose down ComposeDownRequest ComposeResponse

Documentation

Index

Constants

View Source
const (
	//ServiceID represents docker service id
	ServiceID = "docker"
)

Variables

This section is empty.

Functions

func IsGoogleCloudRegistry

func IsGoogleCloudRegistry(URL string) bool

IsGoogleCloudRegistry returns true if url is google docker cloud registry

func New

func New() endly.Service

New creates a new docker service.

Types

type BaseRequest

type BaseRequest struct {
	Target *url.Resource `required:"true" description:"host with docker service"`                //target host
	Name   string        `description:"container name to inspect, if empty it uses target.Name"` //docker container name
}

BaseRequest represents container base request

func NewBaseRequest

func NewBaseRequest(target *url.Resource, name string) *BaseRequest

NewBaseRequest creates a new base request

func (*BaseRequest) Init

func (r *BaseRequest) Init() error

Init initializes request

func (*BaseRequest) Validate

func (r *BaseRequest) Validate() error

Validate checks if request is valid

type BuildRequest

type BuildRequest struct {
	Target    *url.Resource     `required:"true" description:"host with docker service"` //target host
	Tag       *Tag              `required:"true" description:"build docker tag"`
	Path      string            `description:"location of dockerfile"`
	Arguments map[string]string `` //https://docs.docker.com/engine/reference/commandline/build/#description
	/* 133-byte string literal not displayed */
}

BuildRequest represents docker build request

func (*BuildRequest) Init

func (r *BuildRequest) Init()

Init initialises default values

func (*BuildRequest) Validate

func (r *BuildRequest) Validate() error

Validate check if request is valid

type BuildResponse

type BuildResponse struct {
	Stdout string
}

BuildResponse represents docker build response

type Compose

type Compose struct {
	Version  string                    `yaml:"version,omitempty"`  //Docker-compose version
	Services map[string]*DockerService `yaml:"services,omitempty"` //Definition of all services by custom name
	Volumes  map[string]*Volume        `yaml:"volumes,omitempty"`  //Definition of all volumes to be mounted
	Networks map[string]*Network       `yaml:"networks,omitempty"` //Definition of all networks
}

Represents a native docker-compose file

type ComposeError

type ComposeError struct {
	Msg        string
	ComposeURL string
}

Error type related to any docker compose operations

func NewComposeError

func NewComposeError(msg string, composeURL *url.Resource) ComposeError

Create new docker compose error

func (ComposeError) Error

func (e ComposeError) Error() string

type ComposeRequest

type ComposeRequest struct {
	Target      *url.Resource     `required:"true" description:"host with docker and docker-compose service,omitempty"` //target host
	Source      *url.Resource     `required:"true" description:"Url to the docker compose file,omitempty"`
	Credentials map[string]string `` /* 173-byte string literal not displayed */

	// True - docker-compose cli is used, false - (Default) endly parses the compose file and builds as separate docker images.
	// TBD: This is work in progress and not yet supported.
	DoNative bool `` /* 126-byte string literal not displayed */
}

Request to compose, build and run multi-container docker services

func (*ComposeRequest) Init added in v0.8.0

func (r *ComposeRequest) Init() error

func (*ComposeRequest) Validate

func (r *ComposeRequest) Validate() error

type ComposeRequestDown

type ComposeRequestDown struct {
	*ComposeRequest
}

type ComposeRequestUp

type ComposeRequestUp struct {
	*ComposeRequest
	RunInBackground bool //Detached mode
}

type ComposeResponse

type ComposeResponse struct {
	Containers []*ContainerInfo
}

DockerBuildResponse represents docker build response

type ContainerInfo

type ContainerInfo struct {
	ContainerID string
	Image       string
	Command     string
	Status      string
	Port        string
	Names       string
}

ContainerInfo represents a docker container info

type ContainerStatusRequest

type ContainerStatusRequest struct {
	Target *url.Resource `required:"true" description:"host with docker service"` //target host
	Names  string
	Image  string
}

ContainerStatusRequest represents a docker check container status request

type ContainerStatusResponse

type ContainerStatusResponse struct {
	Containers []*ContainerInfo
}

ContainerStatusResponse represents a docker container check response

type DockerService

type DockerService struct {
	Image         string      `yaml:"image,omitempty"`  //Image registry path
	Ports         Ports       `yaml:"ports,omitempty"`  //Ports mapping from host machine to docker container
	InternalPorts ExposePorts `yaml:"expose,omitempty"` //Ports will NOT be exposed from the container to the host machine. But they will be accessible to the linked containers
}

type ExecRequest

type ExecRequest struct {
	*BaseRequest
	Command            string
	Secrets            map[string]string
	Interactive        bool
	AllocateTerminal   bool
	RunInTheBackground bool
}

ExecRequest represents a docker run container command.

func NewExecRequest

func NewExecRequest(super *BaseRequest, command string, secrets map[string]string, interactive bool, allocateTerminal bool, runInTheBackground bool) *ExecRequest

NewExecRequest creates a new request to run command inside container

func NewExecRequestFromURL

func NewExecRequestFromURL(URL string) (*ExecRequest, error)

NewExecRequestFromURL creates a new container run request

type ExecResponse

type ExecResponse struct {
	Stdout string
}

ExecResponse represents a docker run command response

type ExposePorts

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

Maps to "expose:" section of the compose file Ports will NOT be exposed from the container to the host machine. But they will be accessible to the linked containers

type ImageInfo

type ImageInfo struct {
	Repository string
	Tag        string
	ImageID    string
	Size       int
}

ImageInfo represents docker image info

type ImagesRequest

type ImagesRequest struct {
	Target     *url.Resource `required:"true" description:"host with docker service"` //target host
	Repository string        `required:"true"`
	Tag        string        `required:"true"`
}

ImagesRequest represents docker check image request

func NewImagesRequest

func NewImagesRequest(target *url.Resource, repository, tag string) *ImagesRequest

NewImagesRequest creates a new image request

func NewImagesRequestFromURL

func NewImagesRequestFromURL(URL string) (*ImagesRequest, error)

NewImagesRequestFromURL creates a new request from URL

type ImagesResponse

type ImagesResponse struct {
	Images []*ImageInfo
}

ImagesResponse represents a docker check image response

type InspectRequest

type InspectRequest struct {
	*BaseRequest
}

InspectRequest represents a docker inspect request, target name refers to container name

type InspectResponse

type InspectResponse struct {
	Stdout string
	Info   interface{} //you can extract any instance default, for instance to get Ip you can use Info[0].NetworkSettings.IPAddress in the variable action post from key
}

InspectResponse represents a docker inspect request

type LoginRequest

type LoginRequest struct {
	Target      *url.Resource `required:"true" description:"host with docker service"` //target host
	Credentials string        `required:"true" description:"credentials path"`
	Repository  string        `required:"true" description:"repository url"`
}

LoginRequest represents a docker pull request

func (*LoginRequest) Validate

func (r *LoginRequest) Validate() error

Validate checks if request is valid

type LoginResponse

type LoginResponse struct {
	Stdout   string
	Username string
}

LoginResponse represents a docker pull request

type LogoutRequest

type LogoutRequest struct {
	Target     *url.Resource `required:"true" description:"host with docker service"` //target host
	Repository string        `required:"true" description:"repository URL"`
}

LogoutRequest represents a docker pull request

type LogoutResponse

type LogoutResponse struct {
	Stdout string
}

LogoutResponse represents a docker pull request

type LogsRequest

type LogsRequest struct {
	*BaseRequest
}

LogsRequest represents docker runner container logs to take stdout

type LogsResponse

type LogsResponse struct {
	Stdout string
}

LogsResponse represents docker container logs response

type Network

type Network struct {
}

TBD

type Ports

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

Maps to "ports:" section of the compose file Ports will be exposed from the container to the host machine Format is host port:container port e.g. "8080":"8080"

type PullRequest

type PullRequest struct {
	Target     *url.Resource `required:"true" description:"host with docker service"` //target host
	Repository string        `required:"true"`
	Tag        string        `required:"true"`
}

PullRequest represents a docker pull request

type PullResponse

type PullResponse struct {
	*ImageInfo
}

PullResponse represents a docker pull response

type PushRequest

type PushRequest struct {
	Target *url.Resource `required:"true" description:"host with docker service"` //target host
	Tag    *Tag          `required:"true"`
}

PushRequest represents a docker push request

type PushResponse

type PushResponse struct {
}

PushResponse represents a docker push request

type RemoveRequest

type RemoveRequest struct {
	*BaseRequest
}

RemoveRequest represents a docker remove container request

type RemoveResponse

type RemoveResponse struct {
	Stdout string
}

RemoveResponse represents a docker remove container response

type RunRequest

type RunRequest struct {
	Target  *url.Resource     `required:"true" description:"host with docker service"`                //target host
	Name    string            `description:"container name to inspect, if empty it uses target.Name"` //docker container name
	Secrets map[string]string ``                                                                      /* 164-byte string literal not displayed */
	Image   string            `required:"true" description:"container image to run" example:"mysql:5.6"`
	Port    string            `description:"publish a container’s port(s) to the host, docker -p option"`
	Env     map[string]string `description:"set docker container an environment variable, docker -e KEY=VAL  option"`
	Mount   map[string]string `description:"bind mount a volume, docker -v option"`
	Ports   map[string]string `description:"publish a container’s port(s) to the host, docker -p option"`
	Params  map[string]string `description:"other free form docker parameters"`
	Workdir string            `description:"working directory inside the container, docker -w option"`
	Reuse   bool              `description:"reuse existing container if exists, otherwise always removes"`
}

RunRequest represents a docker run request

func NewRunRequest

func NewRunRequest(target *url.Resource, name string, secrets map[string]string, image string, port string, env map[string]string, mount map[string]string, ports map[string]string, params map[string]string, workdir string) *RunRequest

func NewRunRequestFromURL

func NewRunRequestFromURL(URL string) (*RunRequest, error)

NewRunRequestFromURL creates a new request from URL

func (*RunRequest) Validate

func (r *RunRequest) Validate() error

Validate checks if request is valid

type RunResponse

type RunResponse struct {
	*ContainerInfo
}

RunResponse represents a docker run response

type StartRequest

type StartRequest struct {
	*BaseRequest
}

StartRequest represents a docker container start request.

type StartResponse

type StartResponse struct {
	*ContainerInfo
}

StartResponse represents a docker container start response

type StopImagesRequest

type StopImagesRequest struct {
	Target *url.Resource `required:"true" description:"host with docker service"` //target host
	Images []string      `required:"true"`
}

StopImagesRequest represents docker stop running images request

func (StopImagesRequest) Validate

func (r StopImagesRequest) Validate() error

type StopImagesResponse

type StopImagesResponse struct {
	StoppedImages []string
}

StopImagesResponse represents docker stop images response

type StopRequest

type StopRequest struct {
	*BaseRequest
}

StopRequest represents a docker stop container request.

type StopResponse

type StopResponse struct {
	*ContainerInfo
}

StopResponse represents a docker stop container response.

type Tag

type Tag struct {
	Username string
	Registry string
	Image    string
	Version  string
}

Tag represent a docker tag

func (*Tag) String

func (t *Tag) String() string

String stringify docker tag

func (*Tag) Validate

func (t *Tag) Validate() error

Validate checks if tag is valid

type TagRequest

type TagRequest struct {
	Target    *url.Resource `required:"true" description:"host with docker service"` //target host
	SourceTag *Tag          `required:"true"`
	TargetTag *Tag          `required:"true"`
}

TagRequest represents docker tag request

func (*TagRequest) Validate

func (r *TagRequest) Validate() error

Validate checks if request valid

type TagResponse

type TagResponse struct {
	Stdout string
}

TagResponse represents docker tag response

type Volume

type Volume struct {
	Driver        string            `yaml:"driver,omitempty"`      //Specifies the volume driver. Default is local
	DriverOptions map[string]string `yaml:"driver_opts,omitempty"` //Specifies the options to the volume driver
	External      bool              `yaml:"external,omitempty"`    //Specifies this volume is created externally outside of compose and attempting to recreate raises an error
	Source        string            `yaml:"source,omitempty"`      //Specifies the source of mount on the host machine. This is an alternate way of specifying source
	Target        string            `yaml:"target,omitempty"`      //Specifies the target of mount on the container. This is an alternate way of specifying target
	Readonly      bool              `yaml:"read_only,omitempty"`   //Specifies mount is read only
}

Maps to "volumes:" section of the compose file Used to specify the path in host machine to be mounted and available within container and in which path. Format is host path:container path e.g /data/endly:/etc/endly

Jump to

Keyboard shortcuts

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