mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Automatically create non-existent bind-mounted directories on the host
Fixes #1279. Docker-DCO-1.1-Signed-off-by: Maxime Petazzoni <max@signalfuse.com> (github: mpetazzoni)
This commit is contained in:
parent
b417f79c00
commit
3e96f46b30
1 changed files with 5 additions and 2 deletions
|
@ -1909,8 +1909,11 @@ func (srv *Server) ContainerStart(job *engine.Job) engine.Status {
|
||||||
// ensure the source exists on the host
|
// ensure the source exists on the host
|
||||||
_, err := os.Stat(source)
|
_, err := os.Stat(source)
|
||||||
if err != nil && os.IsNotExist(err) {
|
if err != nil && os.IsNotExist(err) {
|
||||||
job.Errorf("Invalid bind mount '%s' : source doesn't exist", bind)
|
err = os.MkdirAll(source, 0755)
|
||||||
return engine.StatusErr
|
if err != nil {
|
||||||
|
job.Errorf("Could not create local directory '%s' for bind mount: %s!", source, err.Error())
|
||||||
|
return engine.StatusErr
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Register any links from the host config before starting the container
|
// Register any links from the host config before starting the container
|
||||||
|
|
Loading…
Add table
Reference in a new issue