2015-11-05 01:38:05 +00:00
|
|
|
package container
|
2015-08-24 17:57:39 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2015-09-23 23:42:08 +00:00
|
|
|
"github.com/docker/docker/api/server/httputils"
|
2015-09-29 21:32:07 +00:00
|
|
|
"golang.org/x/net/context"
|
2015-08-24 17:57:39 +00:00
|
|
|
)
|
|
|
|
|
2016-03-17 17:15:32 +00:00
|
|
|
// getContainersByName inspects container's configuration and serializes it as json.
|
2015-11-05 01:38:05 +00:00
|
|
|
func (s *containerRouter) getContainersByName(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
2015-09-25 12:49:02 +00:00
|
|
|
displaySize := httputils.BoolValue(r, "size")
|
2015-08-24 17:57:39 +00:00
|
|
|
|
2015-09-23 23:42:08 +00:00
|
|
|
version := httputils.VersionFromContext(ctx)
|
2015-11-24 17:55:45 +00:00
|
|
|
json, err := s.backend.ContainerInspect(vars["name"], displaySize, version)
|
2015-08-24 17:57:39 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2015-09-23 23:42:08 +00:00
|
|
|
return httputils.WriteJSON(w, http.StatusOK, json)
|
2015-08-24 17:57:39 +00:00
|
|
|
}
|