engine: resources: docker: Ensure image is specified for containers

This commit is contained in:
Jonathan Gold
2019-02-07 19:04:24 -05:00
committed by James Shubin
parent 1c5fcd59e7
commit bdfb1cf33e

View File

@@ -98,6 +98,11 @@ func (obj *DockerContainerRes) Validate() error {
return fmt.Errorf("state must be running, stopped or removed") return fmt.Errorf("state must be running, stopped or removed")
} }
// make sure an image is specified
if obj.Image == "" {
return fmt.Errorf("image must be specified")
}
// validate env // validate env
for _, env := range obj.Env { for _, env := range obj.Env {
if !strings.Contains(env, "=") || strings.Contains(env, " ") { if !strings.Contains(env, "=") || strings.Contains(env, " ") {