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