2019-03-25 00:27:14 +00:00
|
|
|
package environment
|
|
|
|
|
|
|
|
import (
|
2019-03-25 01:00:21 +00:00
|
|
|
"os"
|
2019-03-25 00:27:14 +00:00
|
|
|
)
|
|
|
|
|
2019-03-25 01:39:01 +00:00
|
|
|
// Defines the docker configuration used by the daemon when interacting with
|
|
|
|
// containers and networks on the system.
|
|
|
|
type DockerConfiguration struct {
|
|
|
|
Container struct {
|
|
|
|
User string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Network configuration that should be used when creating a new network
|
|
|
|
// for containers run through the daemon.
|
|
|
|
Network struct {
|
|
|
|
// The interface that should be used to create the network. Must not conflict
|
|
|
|
// with any other interfaces in use by Docker or on the system.
|
|
|
|
Interface string
|
|
|
|
|
|
|
|
// The name of the network to use. If this network already exists it will not
|
|
|
|
// be created. If it is not found, a new network will be created using the interface
|
|
|
|
// defined.
|
|
|
|
Name string
|
|
|
|
}
|
|
|
|
|
|
|
|
// If true, container images will be updated when a server starts if there
|
|
|
|
// is an update available. If false the daemon will not attempt updates and will
|
|
|
|
// defer to the host system to manage image updates.
|
|
|
|
UpdateImages bool `yaml:"update_images"`
|
2019-03-25 00:27:14 +00:00
|
|
|
|
2019-03-25 01:39:01 +00:00
|
|
|
// The location of the Docker socket.
|
|
|
|
Socket string
|
|
|
|
|
|
|
|
// Defines the location of the timezone file on the host system that should
|
|
|
|
// be mounted into the created containers so that they all use the same time.
|
|
|
|
TimezonePath string `yaml:"timezone_path"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Docker struct {
|
2019-03-25 01:00:21 +00:00
|
|
|
// Defines the configuration for the Docker instance that will allow us to connect
|
|
|
|
// and create and modify containers.
|
2019-03-25 01:39:01 +00:00
|
|
|
Configuration DockerConfiguration
|
2019-03-25 00:27:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Ensure that the Docker environment is always implementing all of the methods
|
|
|
|
// from the base environment interface.
|
|
|
|
var _ Environment = (*Docker)(nil)
|
|
|
|
|
|
|
|
func (d *Docker) Exists() bool {
|
2019-03-25 01:00:21 +00:00
|
|
|
return true
|
2019-03-25 00:27:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (d *Docker) Start() error {
|
2019-03-25 01:00:21 +00:00
|
|
|
return nil
|
2019-03-25 00:27:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (d *Docker) Stop() error {
|
2019-03-25 01:00:21 +00:00
|
|
|
return nil
|
2019-03-25 00:27:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (d *Docker) Terminate(signal os.Signal) error {
|
2019-03-25 01:00:21 +00:00
|
|
|
return nil
|
2019-03-25 00:27:14 +00:00
|
|
|
}
|