Documentation ¶
Index ¶
- Constants
- func AddContainerLog(logPath string, content string) error
- func ContainerVolumeUsage(mp MountPoint) (string, int64, error)
- func GetContainerLogSize(logFile string) string
- func GetDockerRoot() string
- func GetDockerVersion() string
- func GetVolumeRoot() string
- func IsValidStateString(s string) bool
- type Container
- type JSONLog
- type MountPoint
- type State
Constants ¶
const DefaultDockerRoot string = "/var/lib/docker"
const DefaultDockerVersion string = "1.10.0"
Variables ¶
This section is empty.
Functions ¶
func AddContainerLog ¶
AddContainerLog appends a single line of log to container's logfile For this version of daoker, only json-file is supported TODO: support more log drivers.
func ContainerVolumeUsage ¶
func ContainerVolumeUsage(mp MountPoint) (string, int64, error)
ContainerVolumeUsage gets the disk usage and inode usage of a volume only internal volumes are considered like "VOLUME /var/lib/mysql" in Dockerfile we will skip "-v a:b" volumes
func GetContainerLogSize ¶
GetContainerLogSize returns human readable size of container's log file
func GetDockerRoot ¶
func GetDockerRoot() string
GetDockerRoot gets docker root path in Docker environment
func GetDockerVersion ¶
func GetDockerVersion() string
GetDockerVersion gets docker version from env
func GetVolumeRoot ¶
func GetVolumeRoot() string
GetVolumeRoot gets docker volume path in Docker environment
func IsValidStateString ¶
IsValidStateString checks if the provided string is a valid container state or not.
Types ¶
type Container ¶
type Container struct { ID string State State Pnum int Created time.Time Path string Args []string Config *containertypes.Config MountPoints map[string]MountPoint Name string LogPath string }
func Containers ¶
Containers returns an array of docker containers unmarshaled from config.json in docker root path.
func GetContainer ¶
GetContainer returns a container by given IDOrName
type MountPoint ¶
type MountPoint struct { Source string // Container host directory Destination string // Inside the container RW bool // True if writable Name string // Name set by user Driver string // Volume driver to use // Note Mode is not used on Windows Mode string `json:"Relabel"` // Originally field was `Relabel`" // Note Propagation is not used on Windows Propagation string // Mount propagation string Named bool // specifies if the mountpoint was specified by name // Specifies if data should be copied from the container before the first mount // Use a pointer here so we can tell if the user set this value explicitly // This allows us to error out when the user explicitly enabled copy but we can't copy due to the volume being populated CopyData bool `json:"-"` }
MountPoint is the intersection point between a volume and a container. It specifies which volume is to be used and where inside a container it should be mounted.
type State ¶
type State struct { sync.Mutex // FIXME: Why do we have both paused and running if a // container cannot be paused and running at the same time? Running bool Paused bool Restarting bool OOMKilled bool RemovalInProgress bool // Not need for this to be persistent on disk. Dead bool Pid int ExitCode int Error string // contains last known error when starting the container StartedAt time.Time FinishedAt time.Time // contains filtered or unexported fields }
State holds the current container state, and has methods to get and set the state. Container has an embed, which allows all of the functions defined against State to run against Container.
func NewState ¶
func NewState() *State
NewState creates a default state object with a fresh channel for state changes.
func (*State) IsRestarting ¶
IsRestarting returns whether the container is restarting or not.
func (*State) IsRunning ¶
IsRunning returns whether the running flag is set. Used by Container to check whether a container is running.
func (*State) StateString ¶
StateString returns a single string to describe state