api/container_inspect: Ensure Config is not nil in inspect response

Ensure that the JSON response for the `GET /containers/{name}/json`
outputs an empty object instead of a nil config.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2025-10-31 12:40:30 +01:00
parent 3287abc965
commit fd1593c067

View File

@@ -81,5 +81,8 @@ func (c *containerRouter) getContainersByName(ctx context.Context, w http.Respon
}
}
if ctr.Config == nil {
ctr.Config = &container.Config{}
}
return httputils.WriteJSON(w, http.StatusOK, compat.Wrap(ctr, wrapOpts...))
}