|
@@ -32,7 +32,7 @@ type createOpts struct {
|
|
|
}
|
|
|
|
|
|
// CreateManagedContainer creates a container that is managed by a Service
|
|
|
-func (daemon *Daemon) CreateManagedContainer(params types.ContainerCreateConfig) (containertypes.ContainerCreateCreatedBody, error) {
|
|
|
+func (daemon *Daemon) CreateManagedContainer(params types.ContainerCreateConfig) (containertypes.CreateResponse, error) {
|
|
|
return daemon.containerCreate(createOpts{
|
|
|
params: params,
|
|
|
managed: true,
|
|
@@ -40,7 +40,7 @@ func (daemon *Daemon) CreateManagedContainer(params types.ContainerCreateConfig)
|
|
|
}
|
|
|
|
|
|
// ContainerCreate creates a regular container
|
|
|
-func (daemon *Daemon) ContainerCreate(params types.ContainerCreateConfig) (containertypes.ContainerCreateCreatedBody, error) {
|
|
|
+func (daemon *Daemon) ContainerCreate(params types.ContainerCreateConfig) (containertypes.CreateResponse, error) {
|
|
|
return daemon.containerCreate(createOpts{
|
|
|
params: params,
|
|
|
managed: false,
|
|
@@ -49,22 +49,22 @@ func (daemon *Daemon) ContainerCreate(params types.ContainerCreateConfig) (conta
|
|
|
|
|
|
// ContainerCreateIgnoreImagesArgsEscaped creates a regular container. This is called from the builder RUN case
|
|
|
// and ensures that we do not take the images ArgsEscaped
|
|
|
-func (daemon *Daemon) ContainerCreateIgnoreImagesArgsEscaped(params types.ContainerCreateConfig) (containertypes.ContainerCreateCreatedBody, error) {
|
|
|
+func (daemon *Daemon) ContainerCreateIgnoreImagesArgsEscaped(params types.ContainerCreateConfig) (containertypes.CreateResponse, error) {
|
|
|
return daemon.containerCreate(createOpts{
|
|
|
params: params,
|
|
|
managed: false,
|
|
|
ignoreImagesArgsEscaped: true})
|
|
|
}
|
|
|
|
|
|
-func (daemon *Daemon) containerCreate(opts createOpts) (containertypes.ContainerCreateCreatedBody, error) {
|
|
|
+func (daemon *Daemon) containerCreate(opts createOpts) (containertypes.CreateResponse, error) {
|
|
|
start := time.Now()
|
|
|
if opts.params.Config == nil {
|
|
|
- return containertypes.ContainerCreateCreatedBody{}, errdefs.InvalidParameter(errors.New("Config cannot be empty in order to create a container"))
|
|
|
+ return containertypes.CreateResponse{}, errdefs.InvalidParameter(errors.New("Config cannot be empty in order to create a container"))
|
|
|
}
|
|
|
|
|
|
warnings, err := daemon.verifyContainerSettings(opts.params.HostConfig, opts.params.Config, false)
|
|
|
if err != nil {
|
|
|
- return containertypes.ContainerCreateCreatedBody{Warnings: warnings}, errdefs.InvalidParameter(err)
|
|
|
+ return containertypes.CreateResponse{Warnings: warnings}, errdefs.InvalidParameter(err)
|
|
|
}
|
|
|
|
|
|
if opts.params.Platform == nil && opts.params.Config.Image != "" {
|
|
@@ -84,7 +84,7 @@ func (daemon *Daemon) containerCreate(opts createOpts) (containertypes.Container
|
|
|
|
|
|
err = verifyNetworkingConfig(opts.params.NetworkingConfig)
|
|
|
if err != nil {
|
|
|
- return containertypes.ContainerCreateCreatedBody{Warnings: warnings}, errdefs.InvalidParameter(err)
|
|
|
+ return containertypes.CreateResponse{Warnings: warnings}, errdefs.InvalidParameter(err)
|
|
|
}
|
|
|
|
|
|
if opts.params.HostConfig == nil {
|
|
@@ -92,12 +92,12 @@ func (daemon *Daemon) containerCreate(opts createOpts) (containertypes.Container
|
|
|
}
|
|
|
err = daemon.adaptContainerSettings(opts.params.HostConfig, opts.params.AdjustCPUShares)
|
|
|
if err != nil {
|
|
|
- return containertypes.ContainerCreateCreatedBody{Warnings: warnings}, errdefs.InvalidParameter(err)
|
|
|
+ return containertypes.CreateResponse{Warnings: warnings}, errdefs.InvalidParameter(err)
|
|
|
}
|
|
|
|
|
|
ctr, err := daemon.create(opts)
|
|
|
if err != nil {
|
|
|
- return containertypes.ContainerCreateCreatedBody{Warnings: warnings}, err
|
|
|
+ return containertypes.CreateResponse{Warnings: warnings}, err
|
|
|
}
|
|
|
containerActions.WithValues("create").UpdateSince(start)
|
|
|
|
|
@@ -105,7 +105,7 @@ func (daemon *Daemon) containerCreate(opts createOpts) (containertypes.Container
|
|
|
warnings = make([]string, 0) // Create an empty slice to avoid https://github.com/moby/moby/issues/38222
|
|
|
}
|
|
|
|
|
|
- return containertypes.ContainerCreateCreatedBody{ID: ctr.ID, Warnings: warnings}, nil
|
|
|
+ return containertypes.CreateResponse{ID: ctr.ID, Warnings: warnings}, nil
|
|
|
}
|
|
|
|
|
|
// Create creates a new container from the given configuration with a given name.
|