@@ -3,7 +3,6 @@ package daemon // import "github.com/docker/docker/daemon"
33import (
44 "context"
55 "fmt"
6- "runtime"
76 "strings"
87 "time"
98
@@ -23,7 +22,7 @@ import (
2322 "github.com/docker/docker/runconfig"
2423 ocispec "github.com/opencontainers/image-spec/specs-go/v1"
2524 "github.com/opencontainers/selinux/go-selinux"
26- archvariant "github.com/tonistiigi/go-archvariant"
25+ "github.com/tonistiigi/go-archvariant"
2726)
2827
2928type createOpts struct {
@@ -134,7 +133,7 @@ func (daemon *Daemon) create(ctx context.Context, daemonCfg *config.Config, opts
134133 imgManifest * ocispec.Descriptor
135134 imgID image.ID
136135 err error
137- os = runtime . GOOS
136+ platform = platforms . DefaultSpec ()
138137 )
139138
140139 if opts .params .Config .Image != "" {
@@ -152,17 +151,17 @@ func (daemon *Daemon) create(ctx context.Context, daemonCfg *config.Config, opts
152151 return nil , err
153152 }
154153 }
155- os = img .OperatingSystem ()
154+ platform = img .Platform ()
156155 imgID = img .ID ()
157156 } else if isWindows {
158- os = "linux" // 'scratch' case.
157+ platform . OS = "linux" // 'scratch' case.
159158 }
160159
161160 // On WCOW, if are not being invoked by the builder to create this container (where
162161 // ignoreImagesArgEscaped will be true) - if the image already has its arguments escaped,
163162 // ensure that this is replicated across to the created container to avoid double-escaping
164163 // of the arguments/command line when the runtime attempts to run the container.
165- if os == "windows" && ! opts .ignoreImagesArgsEscaped && img != nil && img .RunConfig ().ArgsEscaped {
164+ if platform . OS == "windows" && ! opts .ignoreImagesArgsEscaped && img != nil && img .RunConfig ().ArgsEscaped {
166165 opts .params .Config .ArgsEscaped = true
167166 }
168167
@@ -174,7 +173,7 @@ func (daemon *Daemon) create(ctx context.Context, daemonCfg *config.Config, opts
174173 return nil , errdefs .InvalidParameter (err )
175174 }
176175
177- if ctr , err = daemon .newContainer (opts .params .Name , os , opts .params .Config , opts .params .HostConfig , imgID , opts .managed ); err != nil {
176+ if ctr , err = daemon .newContainer (opts .params .Name , platform , opts .params .Config , opts .params .HostConfig , imgID , opts .managed ); err != nil {
178177 return nil , err
179178 }
180179 defer func () {
0 commit comments