added check for docker backend

This commit is contained in:
xinau 2019-02-12 20:07:13 +00:00
parent 36c1e8d838
commit ae59b81f44
1 changed files with 4 additions and 0 deletions

View File

@ -118,6 +118,10 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
errs = packer.MultiErrorAppend(errs, fmt.Errorf("backend: %s must be a valid backend", p.config.Backend))
}
if p.config.Backend == "docker" && p.config.Host == "" {
errs = packer.MultiErrorAppend(errs, fmt.Errorf("backend: host must be specified for docker backend"))
}
if p.config.Host == "" {
p.config.Host = "127.0.0.1"
}