mirror of
https://github.com/docker/cli.git
synced 2026-01-26 15:41:42 +03:00
Merge pull request #6700 from thaJeztah/fix_validation
docker run, create: don't swallow connection errors during validate
This commit is contained in:
@@ -232,3 +232,7 @@ func (f *fakeClient) ContainerPause(ctx context.Context, containerID string, opt
|
||||
|
||||
return client.ContainerPauseResult{}, nil
|
||||
}
|
||||
|
||||
func (*fakeClient) Ping(_ context.Context, _ client.PingOptions) (client.PingResult, error) {
|
||||
return client.PingResult{}, nil
|
||||
}
|
||||
|
||||
@@ -112,7 +112,12 @@ func runCreate(ctx context.Context, dockerCli command.Cli, flags *pflag.FlagSet,
|
||||
}
|
||||
}
|
||||
copts.env = *opts.NewListOptsRef(&newEnv, nil)
|
||||
containerCfg, err := parse(flags, copts, dockerCli.ServerInfo().OSType)
|
||||
serverInfo, err := dockerCli.Client().Ping(ctx, client.PingOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
containerCfg, err := parse(flags, copts, serverInfo.OSType)
|
||||
if err != nil {
|
||||
return cli.StatusError{
|
||||
Status: withHelp(err, "create").Error(),
|
||||
|
||||
@@ -101,7 +101,12 @@ func runRun(ctx context.Context, dockerCli command.Cli, flags *pflag.FlagSet, ro
|
||||
}
|
||||
}
|
||||
copts.env = *opts.NewListOptsRef(&newEnv, nil)
|
||||
containerCfg, err := parse(flags, copts, dockerCli.ServerInfo().OSType)
|
||||
serverInfo, err := dockerCli.Client().Ping(ctx, client.PingOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
containerCfg, err := parse(flags, copts, serverInfo.OSType)
|
||||
// just in case the parse does not exit
|
||||
if err != nil {
|
||||
return cli.StatusError{
|
||||
|
||||
Reference in New Issue
Block a user