mirror of https://github.com/docker/cli.git
Merge pull request #3764 from thaJeztah/cli_remove_intermediate_var
cli: createContainer() remove intermediate variable
This commit is contained in:
commit
48da8a4b3b
|
@ -203,10 +203,9 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerConfig
|
||||||
config := containerConfig.Config
|
config := containerConfig.Config
|
||||||
hostConfig := containerConfig.HostConfig
|
hostConfig := containerConfig.HostConfig
|
||||||
networkingConfig := containerConfig.NetworkingConfig
|
networkingConfig := containerConfig.NetworkingConfig
|
||||||
stderr := dockerCli.Err()
|
|
||||||
|
|
||||||
warnOnOomKillDisable(*hostConfig, stderr)
|
warnOnOomKillDisable(*hostConfig, dockerCli.Err())
|
||||||
warnOnLocalhostDNS(*hostConfig, stderr)
|
warnOnLocalhostDNS(*hostConfig, dockerCli.Err())
|
||||||
|
|
||||||
var (
|
var (
|
||||||
trustedRef reference.Canonical
|
trustedRef reference.Canonical
|
||||||
|
@ -237,7 +236,7 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
pullAndTagImage := func() error {
|
pullAndTagImage := func() error {
|
||||||
pullOut := stderr
|
pullOut := dockerCli.Err()
|
||||||
if opts.quiet {
|
if opts.quiet {
|
||||||
pullOut = io.Discard
|
pullOut = io.Discard
|
||||||
}
|
}
|
||||||
|
@ -277,7 +276,7 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerConfig
|
||||||
if apiclient.IsErrNotFound(err) && namedRef != nil && opts.pull == PullImageMissing {
|
if apiclient.IsErrNotFound(err) && namedRef != nil && opts.pull == PullImageMissing {
|
||||||
if !opts.quiet {
|
if !opts.quiet {
|
||||||
// we don't want to write to stdout anything apart from container.ID
|
// we don't want to write to stdout anything apart from container.ID
|
||||||
fmt.Fprintf(stderr, "Unable to find image '%s' locally\n", reference.FamiliarString(namedRef))
|
fmt.Fprintf(dockerCli.Err(), "Unable to find image '%s' locally\n", reference.FamiliarString(namedRef))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := pullAndTagImage(); err != nil {
|
if err := pullAndTagImage(); err != nil {
|
||||||
|
@ -295,7 +294,7 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, warning := range response.Warnings {
|
for _, warning := range response.Warnings {
|
||||||
fmt.Fprintf(stderr, "WARNING: %s\n", warning)
|
fmt.Fprintf(dockerCli.Err(), "WARNING: %s\n", warning)
|
||||||
}
|
}
|
||||||
err = containerIDFile.Write(response.ID)
|
err = containerIDFile.Write(response.ID)
|
||||||
return &response, err
|
return &response, err
|
||||||
|
|
Loading…
Reference in New Issue