inspect.go 657 B

123456789101112131415161718192021
  1. package container // import "github.com/docker/docker/api/server/router/container"
  2. import (
  3. "context"
  4. "net/http"
  5. "github.com/docker/docker/api/server/httputils"
  6. )
  7. // getContainersByName inspects container's configuration and serializes it as json.
  8. func (s *containerRouter) getContainersByName(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
  9. displaySize := httputils.BoolValue(r, "size")
  10. version := httputils.VersionFromContext(ctx)
  11. json, err := s.backend.ContainerInspect(ctx, vars["name"], displaySize, version)
  12. if err != nil {
  13. return err
  14. }
  15. return httputils.WriteJSON(w, http.StatusOK, json)
  16. }