github.com/hms58/moby@v1.13.1/api/server/router/container/inspect.go (about)

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