@@ -212,7 +212,7 @@ func newCIDFile(cidPath string) (*cidFile, error) {
212212}
213213
214214//nolint:gocyclo
215- func createContainer (ctx context.Context , dockerCli command.Cli , containerCfg * containerConfig , options * createOptions ) (containerID string , err error ) {
215+ func createContainer (ctx context.Context , dockerCLI command.Cli , containerCfg * containerConfig , options * createOptions ) (containerID string , err error ) {
216216 config := containerCfg .Config
217217 hostConfig := containerCfg .HostConfig
218218 networkingConfig := containerCfg .NetworkingConfig
@@ -251,7 +251,7 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerCfg *c
251251 // 1. Mount the actual docker socket.
252252 // 2. A synthezised ~/.docker/config.json with resolved tokens.
253253
254- if dockerCli .ServerInfo ().OSType == "windows" {
254+ if dockerCLI .ServerInfo ().OSType == "windows" {
255255 return "" , errors .New ("flag --use-api-socket can't be used with a Windows Docker Engine" )
256256 }
257257
@@ -286,18 +286,18 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerCfg *c
286286 })
287287 */
288288
289- var envvarPresent bool
290- for _ , envvar := range containerCfg .Config .Env {
291- if strings .HasPrefix (envvar , "DOCKER_CONFIG=" ) {
292- envvarPresent = true
289+ var envVarPresent bool
290+ for _ , envVar := range containerCfg .Config .Env {
291+ if strings .HasPrefix (envVar , "DOCKER_CONFIG=" ) {
292+ envVarPresent = true
293293 }
294294 }
295295
296296 // If the DOCKER_CONFIG env var is already present, we assume the client knows
297297 // what they're doing and don't inject the creds.
298- if ! envvarPresent {
298+ if ! envVarPresent {
299299 // Resolve this here for later, ensuring we error our before we create the container.
300- creds , err := readCredentials (dockerCli )
300+ creds , err := readCredentials (dockerCLI )
301301 if err != nil {
302302 return "" , fmt .Errorf ("resolving credentials failed: %w" , err )
303303 }
@@ -320,7 +320,7 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerCfg *c
320320 }
321321
322322 pullAndTagImage := func () error {
323- if err := pullImage (ctx , dockerCli , config .Image , options ); err != nil {
323+ if err := pullImage (ctx , dockerCLI , config .Image , options ); err != nil {
324324 return err
325325 }
326326 return nil
@@ -332,9 +332,9 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerCfg *c
332332 }
333333 }
334334
335- hostConfig .ConsoleSize [0 ], hostConfig .ConsoleSize [1 ] = dockerCli .Out ().GetTtySize ()
335+ hostConfig .ConsoleSize [0 ], hostConfig .ConsoleSize [1 ] = dockerCLI .Out ().GetTtySize ()
336336
337- response , err := dockerCli .Client ().ContainerCreate (ctx , client.ContainerCreateOptions {
337+ response , err := dockerCLI .Client ().ContainerCreate (ctx , client.ContainerCreateOptions {
338338 Name : options .name ,
339339 // Image: config.Image, // TODO(thaJeztah): pass image-ref separate
340340 Platform : platform ,
@@ -347,15 +347,15 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerCfg *c
347347 if errdefs .IsNotFound (err ) && namedRef != nil && options .pull == PullImageMissing {
348348 if ! options .quiet {
349349 // we don't want to write to stdout anything apart from container.ID
350- _ , _ = fmt .Fprintf (dockerCli .Err (), "Unable to find image '%s' locally\n " , reference .FamiliarString (namedRef ))
350+ _ , _ = fmt .Fprintf (dockerCLI .Err (), "Unable to find image '%s' locally\n " , reference .FamiliarString (namedRef ))
351351 }
352352
353353 if err := pullAndTagImage (); err != nil {
354354 return "" , err
355355 }
356356
357357 var retryErr error
358- response , retryErr = dockerCli .Client ().ContainerCreate (ctx , client.ContainerCreateOptions {
358+ response , retryErr = dockerCLI .Client ().ContainerCreate (ctx , client.ContainerCreateOptions {
359359 Name : options .name ,
360360 // Image: config.Image, // TODO(thaJeztah): pass image-ref separate
361361 Platform : platform ,
@@ -373,7 +373,7 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerCfg *c
373373
374374 containerID = response .ID
375375 for _ , w := range response .Warnings {
376- _ , _ = fmt .Fprintln (dockerCli .Err (), "WARNING:" , w )
376+ _ , _ = fmt .Fprintln (dockerCLI .Err (), "WARNING:" , w )
377377 }
378378 err = containerIDFile .Write (containerID )
379379
@@ -383,7 +383,7 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerCfg *c
383383 AuthConfigs : apiSocketCreds ,
384384 }
385385
386- if err := copyDockerConfigIntoContainer (ctx , dockerCli .Client (), containerID , dockerConfigPathInContainer , newConfig ); err != nil {
386+ if err := copyDockerConfigIntoContainer (ctx , dockerCLI .Client (), containerID , dockerConfigPathInContainer , newConfig ); err != nil {
387387 return "" , fmt .Errorf ("injecting docker config.json into container failed: %w" , err )
388388 }
389389 }
0 commit comments