зеркало из https://github.com/microsoft/docker.git
Merge pull request #14665 from coolljt0725/fix_build_with_resource_limit
Fix build with resource limit which system not support.
This commit is contained in:
Коммит
6f8c4480e4
|
@ -399,13 +399,13 @@ func (s *Server) postContainersCreate(version version.Version, w http.ResponseWr
|
|||
}
|
||||
adjustCPUShares := version.LessThan("1.19")
|
||||
|
||||
containerID, warnings, err := s.daemon.ContainerCreate(name, config, hostConfig, adjustCPUShares)
|
||||
container, warnings, err := s.daemon.ContainerCreate(name, config, hostConfig, adjustCPUShares)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return writeJSON(w, http.StatusCreated, &types.ContainerCreateResponse{
|
||||
ID: containerID,
|
||||
ID: container.ID,
|
||||
Warnings: warnings,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ func (b *builder) runContextCommand(args []string, allowRemote bool, allowDecomp
|
|||
return nil
|
||||
}
|
||||
|
||||
container, _, err := b.Daemon.Create(b.Config, nil, "")
|
||||
container, _, err := b.Daemon.ContainerCreate("", b.Config, nil, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ func (b *builder) create() (*daemon.Container, error) {
|
|||
config := *b.Config
|
||||
|
||||
// Create the container
|
||||
c, warnings, err := b.Daemon.Create(b.Config, hostConfig, "")
|
||||
c, warnings, err := b.Daemon.ContainerCreate("", b.Config, hostConfig, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -11,15 +11,15 @@ import (
|
|||
"github.com/opencontainers/runc/libcontainer/label"
|
||||
)
|
||||
|
||||
func (daemon *Daemon) ContainerCreate(name string, config *runconfig.Config, hostConfig *runconfig.HostConfig, adjustCPUShares bool) (string, []string, error) {
|
||||
func (daemon *Daemon) ContainerCreate(name string, config *runconfig.Config, hostConfig *runconfig.HostConfig, adjustCPUShares bool) (*Container, []string, error) {
|
||||
if config == nil {
|
||||
return "", nil, fmt.Errorf("Config cannot be empty in order to create a container")
|
||||
return nil, nil, fmt.Errorf("Config cannot be empty in order to create a container")
|
||||
}
|
||||
|
||||
warnings, err := daemon.verifyContainerSettings(hostConfig, config)
|
||||
daemon.adaptContainerSettings(hostConfig, adjustCPUShares)
|
||||
if err != nil {
|
||||
return "", warnings, err
|
||||
return nil, warnings, err
|
||||
}
|
||||
|
||||
container, buildWarnings, err := daemon.Create(config, hostConfig, name)
|
||||
|
@ -29,14 +29,14 @@ func (daemon *Daemon) ContainerCreate(name string, config *runconfig.Config, hos
|
|||
if tag == "" {
|
||||
tag = tags.DefaultTag
|
||||
}
|
||||
return "", warnings, fmt.Errorf("No such image: %s (tag: %s)", config.Image, tag)
|
||||
return nil, warnings, fmt.Errorf("No such image: %s (tag: %s)", config.Image, tag)
|
||||
}
|
||||
return "", warnings, err
|
||||
return nil, warnings, err
|
||||
}
|
||||
|
||||
warnings = append(warnings, buildWarnings...)
|
||||
|
||||
return container.ID, warnings, nil
|
||||
return container, warnings, nil
|
||||
}
|
||||
|
||||
// Create creates a new container from the given configuration with a given name.
|
||||
|
|
Загрузка…
Ссылка в новой задаче