diff --git a/pkg/container/container.go b/pkg/container/container.go index cd6ade01..a0789183 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -65,6 +65,9 @@ func New(sc types.StackerConfig, name string) (*Container, error) { func (c *Container) BindMount(source string, dest string, extraOpts string) error { createOpt := "create=dir" stat, err := os.Stat(source) + if os.IsNotExist(err) { + return errors.Errorf("bind mount source %q does not exist, refusing bind mount: %s", source, err) + } if err == nil && !stat.IsDir() { createOpt = "create=file" } diff --git a/pkg/stacker/build.go b/pkg/stacker/build.go index c1d30f76..8771e75d 100644 --- a/pkg/stacker/build.go +++ b/pkg/stacker/build.go @@ -820,9 +820,10 @@ func SetupLayerConfig(config types.StackerConfig, c *container.Container, l type } for _, bind := range l.Binds { + log.Debugf("bind mounting %q into container at %q", bind.Source, bind.Dest) err = c.BindMount(bind.Source, bind.Dest, "") if err != nil { - return err + return errors.Errorf("failed to bind mount %q at %q: %s", bind.Source, bind.Dest, err) } }