mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-06 05:31:47 +00:00
refactor create to not expose internal data structures
- use existing exposed type Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
This commit is contained in:
@@ -366,10 +366,8 @@ func (s *Server) postContainersCreate(ctx context.Context, w http.ResponseWriter
|
||||
if err := checkForJSON(r); err != nil {
|
||||
return err
|
||||
}
|
||||
var (
|
||||
warnings []string
|
||||
name = r.Form.Get("name")
|
||||
)
|
||||
|
||||
name := r.Form.Get("name")
|
||||
|
||||
config, hostConfig, err := runconfig.DecodeContainerConfig(r.Body)
|
||||
if err != nil {
|
||||
@@ -378,15 +376,12 @@ func (s *Server) postContainersCreate(ctx context.Context, w http.ResponseWriter
|
||||
version := ctx.Version()
|
||||
adjustCPUShares := version.LessThan("1.19")
|
||||
|
||||
container, warnings, err := s.daemon.ContainerCreate(ctx, name, config, hostConfig, adjustCPUShares)
|
||||
ccr, err := s.daemon.ContainerCreate(ctx, name, config, hostConfig, adjustCPUShares)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return writeJSON(w, http.StatusCreated, &types.ContainerCreateResponse{
|
||||
ID: container.ID,
|
||||
Warnings: warnings,
|
||||
})
|
||||
return writeJSON(w, http.StatusCreated, ccr)
|
||||
}
|
||||
|
||||
func (s *Server) deleteContainers(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
|
||||
Reference in New Issue
Block a user