Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateID() string
- func GetDefaultNetworkMtu() int
- func GetVersion(job *engine.Job) engine.Status
- func InitServer(job *engine.Job) engine.Status
- func StoreImage(img *Image, jsonData []byte, layerData archive.ArchiveReader, ...) error
- func ValidateID(id string) error
- type BindMap
- type BuildFile
- type Change
- type Container
- func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, stdout io.Writer, stderr io.Writer) chan error
- func (container *Container) BasefsPath() string
- func (container *Container) Changes() ([]archive.Change, error)
- func (container *Container) Copy(resource string) (io.ReadCloser, error)
- func (container *Container) EnvConfigPath() (string, error)
- func (container *Container) Export() (archive.Archive, error)
- func (container *Container) ExportRw() (archive.Archive, error)
- func (container *Container) Exposes(p nat.Port) bool
- func (container *Container) FromDisk() error
- func (container *Container) GetImage() (*Image, error)
- func (container *Container) GetPtyMaster() (*os.File, error)
- func (container *Container) GetSize() (int64, int64)
- func (container *Container) Inject(file io.Reader, pth string) error
- func (container *Container) Kill() error
- func (container *Container) Mount() error
- func (container *Container) Output() (output []byte, err error)
- func (container *Container) ReadLog(name string) (io.Reader, error)
- func (container *Container) Resize(h, w int) error
- func (container *Container) Restart(seconds int) error
- func (container *Container) RootfsPath() string
- func (container *Container) Run() error
- func (container *Container) Start() (err error)
- func (container *Container) StderrPipe() (io.ReadCloser, error)
- func (container *Container) StdinPipe() (io.WriteCloser, error)
- func (container *Container) StdoutPipe() (io.ReadCloser, error)
- func (container *Container) Stop(seconds int) error
- func (container *Container) ToDisk() (err error)
- func (container *Container) Unmount() error
- func (container *Container) Wait() int
- func (container *Container) WaitTimeout(timeout time.Duration) error
- func (container *Container) When() time.Time
- type DaemonConfig
- type Graph
- func (graph *Graph) ByParent() (map[string][]*Image, error)
- func (graph *Graph) Create(layerData archive.ArchiveReader, container *Container, comment, author string, ...) (*Image, error)
- func (graph *Graph) Delete(name string) error
- func (graph *Graph) Driver() graphdriver.Driver
- func (graph *Graph) Exists(id string) bool
- func (graph *Graph) Get(name string) (*Image, error)
- func (graph *Graph) Heads() (map[string]*Image, error)
- func (graph *Graph) IsNotExist(err error) bool
- func (graph *Graph) Map() (map[string]*Image, error)
- func (graph *Graph) Mktemp(id string) (string, error)
- func (graph *Graph) Register(jsonData []byte, layerData archive.ArchiveReader, img *Image) (err error)
- func (graph *Graph) TempLayerArchive(id string, compression archive.Compression, sf *utils.StreamFormatter, ...) (*archive.TempArchive, error)
- type History
- type Image
- func (img *Image) Depth() (int, error)
- func (img *Image) GetParent() (*Image, error)
- func (img *Image) History() ([]*Image, error)
- func (img *Image) SaveSize(root string) error
- func (img *Image) TarLayer() (arch archive.Archive, err error)
- func (img *Image) WalkHistory(handler func(*Image) error) (err error)
- type NetworkSettings
- type PortMapping
- type Repository
- type Runtime
- func (runtime *Runtime) Changes(container *Container) ([]archive.Change, error)
- func (runtime *Runtime) Children(name string) (map[string]*Container, error)
- func (runtime *Runtime) Close() error
- func (runtime *Runtime) Commit(container *Container, repository, tag, comment, author string, ...) (*Image, error)
- func (runtime *Runtime) Create(config *runconfig.Config, name string) (*Container, []string, error)
- func (runtime *Runtime) Destroy(container *Container) error
- func (runtime *Runtime) Diff(container *Container) (archive.Archive, error)
- func (runtime *Runtime) Exists(id string) bool
- func (runtime *Runtime) Get(name string) *Container
- func (runtime *Runtime) GetByName(name string) (*Container, error)
- func (runtime *Runtime) Graph() *Graph
- func (runtime *Runtime) Kill(c *Container, sig int) error
- func (runtime *Runtime) List() []*Container
- func (runtime *Runtime) LogToDisk(src *utils.WriteBroadcaster, dst, stream string) error
- func (runtime *Runtime) Mount(container *Container) error
- func (runtime *Runtime) Nuke() error
- func (runtime *Runtime) Register(container *Container) error
- func (runtime *Runtime) RegisterLink(parent, child *Container, alias string) error
- func (runtime *Runtime) RestoreCommand(c *Container) error
- func (runtime *Runtime) Run(c *Container, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error)
- func (runtime *Runtime) Unmount(container *Container) error
- type Server
- func (srv *Server) AddEvent(jm utils.JSONMessage)
- func (srv *Server) Auth(job *engine.Job) engine.Status
- func (srv *Server) Build(job *engine.Job) engine.Status
- func (srv *Server) Close() error
- func (srv *Server) ContainerAttach(job *engine.Job) engine.Status
- func (srv *Server) ContainerChanges(job *engine.Job) engine.Status
- func (srv *Server) ContainerCommit(job *engine.Job) engine.Status
- func (srv *Server) ContainerCopy(job *engine.Job) engine.Status
- func (srv *Server) ContainerCreate(job *engine.Job) engine.Status
- func (srv *Server) ContainerDestroy(job *engine.Job) engine.Status
- func (srv *Server) ContainerExport(job *engine.Job) engine.Status
- func (srv *Server) ContainerInspect(name string) (*Container, error)
- func (srv *Server) ContainerKill(job *engine.Job) engine.Status
- func (srv *Server) ContainerResize(job *engine.Job) engine.Status
- func (srv *Server) ContainerRestart(job *engine.Job) engine.Status
- func (srv *Server) ContainerStart(job *engine.Job) engine.Status
- func (srv *Server) ContainerStop(job *engine.Job) engine.Status
- func (srv *Server) ContainerTop(job *engine.Job) engine.Status
- func (srv *Server) ContainerWait(job *engine.Job) engine.Status
- func (srv *Server) Containers(job *engine.Job) engine.Status
- func (srv *Server) DeleteImage(name string, imgs *engine.Table, first, force bool) error
- func (srv *Server) DockerInfo(job *engine.Job) engine.Status
- func (srv *Server) Events(job *engine.Job) engine.Status
- func (srv *Server) GetEvents() []utils.JSONMessage
- func (srv *Server) HTTPRequestFactory(metaHeaders map[string][]string) *utils.HTTPRequestFactory
- func (srv *Server) ImageDelete(job *engine.Job) engine.Status
- func (srv *Server) ImageExport(job *engine.Job) engine.Status
- func (srv *Server) ImageGetCached(imgID string, config *runconfig.Config) (*Image, error)
- func (srv *Server) ImageHistory(job *engine.Job) engine.Status
- func (srv *Server) ImageImport(job *engine.Job) engine.Status
- func (srv *Server) ImageInsert(job *engine.Job) engine.Status
- func (srv *Server) ImageInspect(name string) (*Image, error)
- func (srv *Server) ImageLoad(job *engine.Job) engine.Status
- func (srv *Server) ImagePull(job *engine.Job) engine.Status
- func (srv *Server) ImagePush(job *engine.Job) engine.Status
- func (srv *Server) ImageTag(job *engine.Job) engine.Status
- func (srv *Server) Images(job *engine.Job) engine.Status
- func (srv *Server) ImagesSearch(job *engine.Job) engine.Status
- func (srv *Server) ImagesViz(job *engine.Job) engine.Status
- func (srv *Server) JobInspect(job *engine.Job) engine.Status
- func (srv *Server) LogEvent(action, id, from string) *utils.JSONMessage
- func (srv *Server) RegisterLinks(container *Container, hostConfig *runconfig.HostConfig) error
- type State
- type StderrFormater
- type StdoutFormater
- type TagStore
- func (store *TagStore) ByID() map[string][]string
- func (store *TagStore) Delete(repoName, tag string) (bool, error)
- func (store *TagStore) DeleteAll(id string) error
- func (store *TagStore) Get(repoName string) (Repository, error)
- func (store *TagStore) GetImage(repoName, tagOrID string) (*Image, error)
- func (store *TagStore) ImageName(id string) string
- func (store *TagStore) LookupImage(name string) (*Image, error)
- func (store *TagStore) Reload() error
- func (store *TagStore) Save() error
- func (store *TagStore) Set(repoName, tag, imageName string, force bool) error
Constants ¶
const DEFAULTTAG = "latest"
const (
DisableNetworkBridge = "none"
)
const MaxImageDepth = 127
Set the max depth to the aufs default that most kernels are compiled with For more information see: http://sourceforge.net/p/aufs/aufs3-standalone/ci/aufs3.12/tree/config.mk
Variables ¶
var ( ErrNotATTY = errors.New("The PTY is not a file") ErrNoTTY = errors.New("No PTY found") ErrContainerStart = errors.New("The container failed to start. Unknown error") ErrContainerStartTimeout = errors.New("The container failed to start due to timed out.") )
var (
ErrDockerfileEmpty = errors.New("Dockerfile cannot be empty")
)
Functions ¶
func GenerateID ¶
func GenerateID() string
func GetDefaultNetworkMtu ¶
func GetDefaultNetworkMtu() int
func InitServer ¶
jobInitApi runs the remote api server `srv` as a daemon, Only one api server can run at the same time - this is enforced by a pidfile. The signals SIGINT, SIGQUIT and SIGTERM are intercepted for cleanup.
func StoreImage ¶
func ValidateID ¶
Types ¶
type BuildFile ¶
type BuildFile interface { Build(io.Reader) (string, error) CmdFrom(string) error CmdRun(string) error }
func NewBuildFile ¶
func NewBuildFile(srv *Server, outStream, errStream io.Writer, verbose, utilizeCache, rm bool, outOld io.Writer, sf *utils.StreamFormatter, auth *auth.AuthConfig, authConfigFile *auth.ConfigFile) BuildFile
type Container ¶
type Container struct { sync.Mutex ID string Created time.Time Path string Args []string Config *runconfig.Config State State Image string NetworkSettings *NetworkSettings ResolvConfPath string HostnamePath string HostsPath string Name string Driver string Volumes map[string]string // Store rw/ro in a separate structure to preserve reverse-compatibility on-disk. // Easier than migrating older container configs :) VolumesRW map[string]bool // contains filtered or unexported fields }
func (*Container) BasefsPath ¶
This is the stand-alone version of the root fs, without any additional mounts. This directory is usable whenever the container is mounted (and not unmounted)
func (*Container) EnvConfigPath ¶
func (*Container) RootfsPath ¶
This method must be exported to be used from the lxc template This directory is only usable when the container is running
func (*Container) StderrPipe ¶
func (container *Container) StderrPipe() (io.ReadCloser, error)
func (*Container) StdoutPipe ¶
func (container *Container) StdoutPipe() (io.ReadCloser, error)
func (*Container) WaitTimeout ¶
type DaemonConfig ¶
type DaemonConfig struct { Pidfile string Root string AutoRestart bool Dns []string EnableIptables bool EnableIpForward bool DefaultIp net.IP BridgeIface string BridgeIP string InterContainerCommunication bool GraphDriver string ExecDriver string Mtu int DisableNetwork bool }
FIXME: separate runtime configuration from http api configuration
func DaemonConfigFromJob ¶
func DaemonConfigFromJob(job *engine.Job) *DaemonConfig
ConfigFromJob creates and returns a new DaemonConfig object by parsing the contents of a job's environment.
type Graph ¶
type Graph struct { Root string // contains filtered or unexported fields }
A Graph is a store for versioned filesystem images and the relationship between them.
func NewGraph ¶
func NewGraph(root string, driver graphdriver.Driver) (*Graph, error)
NewGraph instantiates a new graph at the given root path in the filesystem. `root` will be created if it doesn't exist.
func (*Graph) ByParent ¶
ByParent returns a lookup table of images by their parent. If an image of id ID has 3 children images, then the value for key ID will be a list of 3 images. If an image has no children, it will not have an entry in the table.
func (*Graph) Create ¶
func (graph *Graph) Create(layerData archive.ArchiveReader, container *Container, comment, author string, config *runconfig.Config) (*Image, error)
Create creates a new image and registers it in the graph.
func (*Graph) Driver ¶
func (graph *Graph) Driver() graphdriver.Driver
func (*Graph) Exists ¶
Exists returns true if an image is registered at the given id. If the image doesn't exist or if an error is encountered, false is returned.
func (*Graph) Get ¶
Get returns the image with the given id, or an error if the image doesn't exist.
func (*Graph) Heads ¶
Heads returns all heads in the graph, keyed by id. A head is an image which is not the parent of another image in the graph.
func (*Graph) IsNotExist ¶
FIXME: Implement error subclass instead of looking at the error text Note: This is the way golang implements os.IsNotExists on Plan9
func (*Graph) Register ¶
func (graph *Graph) Register(jsonData []byte, layerData archive.ArchiveReader, img *Image) (err error)
Register imports a pre-existing image into the graph. FIXME: pass img as first argument
func (*Graph) TempLayerArchive ¶
func (graph *Graph) TempLayerArchive(id string, compression archive.Compression, sf *utils.StreamFormatter, output io.Writer) (*archive.TempArchive, error)
TempLayerArchive creates a temporary archive of the given image's filesystem layer.
The archive is stored on disk and will be automatically deleted as soon as has been read. If output is not nil, a human-readable progress bar will be written to it. FIXME: does this belong in Graph? How about MktempFile, let the caller use it for archives?
type History ¶
type History []*Container
History is a convenience type for storing a list of containers, ordered by creation date.
type Image ¶
type Image struct { ID string `json:"id"` Parent string `json:"parent,omitempty"` Comment string `json:"comment,omitempty"` Created time.Time `json:"created"` Container string `json:"container,omitempty"` ContainerConfig runconfig.Config `json:"container_config,omitempty"` DockerVersion string `json:"docker_version,omitempty"` Author string `json:"author,omitempty"` Config *runconfig.Config `json:"config,omitempty"` Architecture string `json:"architecture,omitempty"` OS string `json:"os,omitempty"` Size int64 // contains filtered or unexported fields }
func NewImgJSON ¶
Build an Image object from raw json data
func (*Image) History ¶
Image includes convenience proxy functions to its graph These functions will return an error if the image is not registered (ie. if image.graph == nil)
type NetworkSettings ¶
type NetworkSettings struct { IPAddress string IPPrefixLen int Gateway string Bridge string PortMapping map[string]PortMapping // Deprecated Ports nat.PortMap }
func (*NetworkSettings) PortMappingAPI ¶
func (settings *NetworkSettings) PortMappingAPI() *engine.Table
type PortMapping ¶
FIXME: move deprecated port stuff to nat to clean up the core.
type Repository ¶
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func NewRuntime ¶
func NewRuntime(config *DaemonConfig, eng *engine.Engine) (*Runtime, error)
FIXME: harmonize with NewGraph()
func NewRuntimeFromDirectory ¶
func NewRuntimeFromDirectory(config *DaemonConfig, eng *engine.Engine) (*Runtime, error)
func (*Runtime) Commit ¶
func (runtime *Runtime) Commit(container *Container, repository, tag, comment, author string, config *runconfig.Config) (*Image, error)
Commit creates a new filesystem image from the current state of a container. The image can optionally be tagged into a repository
func (*Runtime) Create ¶
Create creates a new container from the given configuration with a given name.
func (*Runtime) Destroy ¶
Destroy unregisters a container from the runtime and cleanly removes its contents from the filesystem.
func (*Runtime) Exists ¶
Exists returns a true if a container of the specified ID or name exists, false otherwise.
func (*Runtime) Get ¶
Get looks for a container by the specified ID or name, and returns it. If the container is not found, or if an error occurs, nil is returned.
func (*Runtime) Graph ¶
FIXME: this is a convenience function for integration tests which need direct access to runtime.graph. Once the tests switch to using engine and jobs, this method can go away.
func (*Runtime) LogToDisk ¶
func (runtime *Runtime) LogToDisk(src *utils.WriteBroadcaster, dst, stream string) error
func (*Runtime) Nuke ¶
Nuke kills all containers then removes all content from the content root, including images, volumes and container filesystems. Again: this will remove your entire docker runtime!
func (*Runtime) Register ¶
Register makes a container object usable by the runtime as <container.ID>
func (*Runtime) RegisterLink ¶
func (*Runtime) RestoreCommand ¶
func (*Runtime) Run ¶
func (runtime *Runtime) Run(c *Container, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error)
type Server ¶
func (*Server) AddEvent ¶
func (srv *Server) AddEvent(jm utils.JSONMessage)
func (*Server) ContainerChanges ¶
func (*Server) ContainerDestroy ¶
func (*Server) ContainerInspect ¶
func (*Server) ContainerKill ¶
ContainerKill send signal to the container If no signal is given (sig 0), then Kill with SIGKILL and wait for the container to exit. If a signal is given, then just send it to the container and return.
func (*Server) ContainerRestart ¶
func (*Server) DeleteImage ¶
func (*Server) GetEvents ¶
func (srv *Server) GetEvents() []utils.JSONMessage
func (*Server) HTTPRequestFactory ¶
func (srv *Server) HTTPRequestFactory(metaHeaders map[string][]string) *utils.HTTPRequestFactory
func (*Server) ImageExport ¶
ImageExport exports all images with the given tag. All versions containing the same tag are exported. The resulting output is an uncompressed tar ball. name is the set of tags to export. out is the writer where the images are written to.
func (*Server) ImageGetCached ¶
func (*Server) ImageLoad ¶
Loads a set of images into the repository. This is the complementary of ImageExport. The input stream is an uncompressed tar ball containing images and metadata.
func (*Server) ImagePush ¶
FIXME: Allow to interrupt current push when new push of same image is done.
func (*Server) RegisterLinks ¶
func (srv *Server) RegisterLinks(container *Container, hostConfig *runconfig.HostConfig) error
type State ¶
type State struct { sync.RWMutex Running bool Pid int ExitCode int StartedAt time.Time FinishedAt time.Time Ghost bool }
func (*State) GetExitCode ¶
func (*State) SetRunning ¶
func (*State) SetStopped ¶
type StderrFormater ¶
type StderrFormater struct { io.Writer *utils.StreamFormatter }
type StdoutFormater ¶
type StdoutFormater struct { io.Writer *utils.StreamFormatter }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
native
These types are wrappers around the libcontainer Terminal interface so that we can resuse the docker implementations where possible.
|
These types are wrappers around the libcontainer Terminal interface so that we can resuse the docker implementations where possible. |
pkg
|
|
listenbuffer
Package to allow go applications to immediately start listening on a socket, unix, tcp, udp but hold connections until the application has booted and is ready to accept them
|
Package to allow go applications to immediately start listening on a socket, unix, tcp, udp but hold connections until the application has booted and is ready to accept them |
mflag
Package flag implements command-line flag parsing.
|
Package flag implements command-line flag parsing. |
netlink
Packet netlink provide access to low level Netlink sockets and messages.
|
Packet netlink provide access to low level Netlink sockets and messages. |