mirror of https://github.com/docker/compose.git
Move list of run specific flags where it’s used
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
parent
6a9d7c1371
commit
cfa090459b
|
@ -39,9 +39,6 @@ const (
|
|||
RestartPolicyRunAlways = "always"
|
||||
)
|
||||
|
||||
// RestartPolicyList all available restart policy values
|
||||
var RestartPolicyList = []string{RestartPolicyRunNo, RestartPolicyRunAlways, RestartPolicyOnFailure}
|
||||
|
||||
// Container represents a created container
|
||||
type Container struct {
|
||||
ID string
|
||||
|
|
|
@ -53,6 +53,9 @@ type Opts struct {
|
|||
HealthTimeout time.Duration
|
||||
}
|
||||
|
||||
// RestartPolicyList all available restart policy values
|
||||
var RestartPolicyList = []string{containers.RestartPolicyRunNo, containers.RestartPolicyRunAlways, containers.RestartPolicyOnFailure}
|
||||
|
||||
// ToContainerConfig convert run options to a container configuration
|
||||
func (r *Opts) ToContainerConfig(image string) (containers.ContainerConfig, error) {
|
||||
if r.Name == "" {
|
||||
|
@ -124,7 +127,7 @@ var restartPolicyMap = map[string]string{
|
|||
func toRestartPolicy(value string) (string, error) {
|
||||
value, ok := restartPolicyMap[value]
|
||||
if !ok {
|
||||
return "", fmt.Errorf("invalid restart value, must be one of %s", strings.Join(containers.RestartPolicyList, ", "))
|
||||
return "", fmt.Errorf("invalid restart value, must be one of %s", strings.Join(RestartPolicyList, ", "))
|
||||
}
|
||||
return value, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue