|
@@ -42,8 +42,7 @@ func init() {
|
|
// The signals SIGINT, SIGQUIT and SIGTERM are intercepted for cleanup.
|
|
// The signals SIGINT, SIGQUIT and SIGTERM are intercepted for cleanup.
|
|
func jobInitApi(job *engine.Job) engine.Status {
|
|
func jobInitApi(job *engine.Job) engine.Status {
|
|
job.Logf("Creating server")
|
|
job.Logf("Creating server")
|
|
- // FIXME: ImportEnv deprecates ConfigFromJob
|
|
|
|
- srv, err := NewServer(job.Eng, ConfigFromJob(job))
|
|
|
|
|
|
+ srv, err := NewServer(job.Eng, DaemonConfigFromJob(job))
|
|
if err != nil {
|
|
if err != nil {
|
|
job.Error(err)
|
|
job.Error(err)
|
|
return engine.StatusErr
|
|
return engine.StatusErr
|
|
@@ -1742,11 +1741,7 @@ func (srv *Server) ContainerCreate(job *engine.Job) engine.Status {
|
|
job.Printf("Usage: %s", job.Name)
|
|
job.Printf("Usage: %s", job.Name)
|
|
return engine.StatusErr
|
|
return engine.StatusErr
|
|
}
|
|
}
|
|
- var config Config
|
|
|
|
- if err := job.ExportEnv(&config); err != nil {
|
|
|
|
- job.Error(err)
|
|
|
|
- return engine.StatusErr
|
|
|
|
- }
|
|
|
|
|
|
+ config := ContainerConfigFromJob(job)
|
|
if config.Memory != 0 && config.Memory < 524288 {
|
|
if config.Memory != 0 && config.Memory < 524288 {
|
|
job.Errorf("Minimum memory limit allowed is 512k")
|
|
job.Errorf("Minimum memory limit allowed is 512k")
|
|
return engine.StatusErr
|
|
return engine.StatusErr
|
|
@@ -1769,7 +1764,7 @@ func (srv *Server) ContainerCreate(job *engine.Job) engine.Status {
|
|
config.Dns = defaultDns
|
|
config.Dns = defaultDns
|
|
}
|
|
}
|
|
|
|
|
|
- container, buildWarnings, err := srv.runtime.Create(&config, name)
|
|
|
|
|
|
+ container, buildWarnings, err := srv.runtime.Create(config, name)
|
|
if err != nil {
|
|
if err != nil {
|
|
if srv.runtime.graph.IsNotExist(err) {
|
|
if srv.runtime.graph.IsNotExist(err) {
|
|
_, tag := utils.ParseRepositoryTag(config.Image)
|
|
_, tag := utils.ParseRepositoryTag(config.Image)
|
|
@@ -2196,11 +2191,7 @@ func (srv *Server) ContainerStart(job *engine.Job) engine.Status {
|
|
}
|
|
}
|
|
// If no environment was set, then no hostconfig was passed.
|
|
// If no environment was set, then no hostconfig was passed.
|
|
if len(job.Environ()) > 0 {
|
|
if len(job.Environ()) > 0 {
|
|
- var hostConfig HostConfig
|
|
|
|
- if err := job.ExportEnv(&hostConfig); err != nil {
|
|
|
|
- job.Error(err)
|
|
|
|
- return engine.StatusErr
|
|
|
|
- }
|
|
|
|
|
|
+ hostConfig := ContainerHostConfigFromJob(job)
|
|
// Validate the HostConfig binds. Make sure that:
|
|
// Validate the HostConfig binds. Make sure that:
|
|
// 1) the source of a bind mount isn't /
|
|
// 1) the source of a bind mount isn't /
|
|
// The bind mount "/:/foo" isn't allowed.
|
|
// The bind mount "/:/foo" isn't allowed.
|
|
@@ -2227,11 +2218,11 @@ func (srv *Server) ContainerStart(job *engine.Job) engine.Status {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Register any links from the host config before starting the container
|
|
// Register any links from the host config before starting the container
|
|
- if err := srv.RegisterLinks(container, &hostConfig); err != nil {
|
|
|
|
|
|
+ if err := srv.RegisterLinks(container, hostConfig); err != nil {
|
|
job.Error(err)
|
|
job.Error(err)
|
|
return engine.StatusErr
|
|
return engine.StatusErr
|
|
}
|
|
}
|
|
- container.hostConfig = &hostConfig
|
|
|
|
|
|
+ container.hostConfig = hostConfig
|
|
container.ToDisk()
|
|
container.ToDisk()
|
|
}
|
|
}
|
|
if err := container.Start(); err != nil {
|
|
if err := container.Start(); err != nil {
|