2015-11-04 20:38:05 -05:00
|
|
|
package container
|
2015-08-24 13:57:39 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2015-09-23 19:42:08 -04:00
|
|
|
"github.com/docker/docker/api/server/httputils"
|
2015-09-29 17:32:07 -04:00
|
|
|
"golang.org/x/net/context"
|
2015-08-24 13:57:39 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// getContainersByName inspects containers 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
|
|
|
}
|