Move the inspect code away from the image service
**- What I did**

The LoopkupImage method is only used by the inspect image route and
returns an api/type struct. The depenency to api/types of the
daemon/images package is wrong, the daemon doesn't need to know about
the api types.

This is a first step in making the image service smaller, it has too many methods as is:

```golang
GetLayerByID(string) (layer.RWLayer, error)
GetLayerMountID(string) (string, error)
Cleanup() error
GraphDriverName() string
CommitBuildStep(context.Context, backend.CommitConfig) (image.ID, error)
CreateImage(ctx context.Context, config []byte, parent string) (builder.Image, error)
GetImageAndReleasableLayer(ctx context.Context, refOrID string, opts backend.GetImageAndLayerOptions) (builder.Image, builder.ROLayer, error)
MakeImageCache(ctx context.Context, sourceRefs []string) (builder.ImageCache, error)
TagImageWithReference(ctx context.Context, imageID image.ID, newTag reference.Named) error
SquashImage(ctx context.Context, id, parent string) (string, error)
ExportImage(ctx context.Context, names []string, outStream io.Writer) error
ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error)
ImageHistory(ctx context.Context, name string) ([]*imagetypes.HistoryResponseItem, error)
Images(ctx context.Context, opts types.ImageListOptions) ([]*types.ImageSummary, error)
ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error)
ImportImage(ctx context.Context, src string, repository string, platform *specs.Platform, tag string, msg string, inConfig io.ReadCloser, outStream io.Writer, changes []string) error
LoadImage(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) error
LookupImage(ctx context.Context, name string) (*types.ImageInspect, error)
PullImage(ctx context.Context, image, tag string, platform *specs.Platform, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error
PushImage(ctx context.Context, image, tag string, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error
SearchRegistryForImages(ctx context.Context, searchFilters filters.Args, term string, limit int, authConfig *types.AuthConfig, metaHeaders map[string][]string) (*registrytypes.SearchResults, error)
TagImage(ctx context.Context, imageName, repository, tag string) (string, error)
GetRepository(context.Context, reference.Named, *types.AuthConfig) (distribution.Repository, error)
ImageDiskUsage(ctx context.Context) ([]*types.ImageSummary, error)
LayerDiskUsage(ctx context.Context) (int64, error)
ReleaseLayer(rwlayer layer.RWLayer) error
CommitImage(ctx context.Context, c backend.CommitConfig) (image.ID, error)
GetImage(ctx context.Context, refOrID string, platform *specs.Platform) (retImg *image.Image, retErr error)
CreateLayer(ctx context.Context, container *container.Container, initFunc layer.MountInit) (layer.RWLayer, error)
DistributionServices() images.DistributionServices
CountImages(ctx context.Context) (int, error)
LayerStoreStatus() [][2]string
GetContainerLayerSize(containerID string) (int64, int64)
UpdateConfig(maxDownloads, maxUploads *int)
Children(ctx context.Context, id image.ID) ([]image.ID, error)
```

And all of these either take some `api/type` struct as a parameter or return one:
```golang
ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error)
Images(ctx context.Context, opts types.ImageListOptions) ([]*types.ImageSummary, error)
ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error)
LookupImage(ctx context.Context, name string) (*types.ImageInspect, error)
PullImage(ctx context.Context, image, tag string, platform *specs.Platform, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error
PushImage(ctx context.Context, image, tag string, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error
SearchRegistryForImages(ctx context.Context, searchFilters filters.Args, term string, limit int, authConfig *types.AuthConfig, metaHeaders map[string][]string) (*registrytypes.SearchResults, error)
GetRepository(context.Context, reference.Named, *types.AuthConfig) (distribution.Repository, error)
ImageDiskUsage(ctx context.Context) ([]*types.ImageSummary, error)
```

I would like to take a closer look at all of those and either change the types returned or move the methods around. Splitting all of this code will make the image service make more sense, as is, it's too large and does too many things.

**- How I did it**

Copied the code over to the route handler

**- How to verify it**

```console
$ docker pull hello-world
$ docker image inspect hello-world # Should still work
```

**- A picture of a cute animal (not mandatory but encouraged)**
![image](https://user-images.githubusercontent.com/99933/171656957-5ff94347-c7ef-4eaa-821b-57c833c90c39.png)

api/server/router/image/image.go
package image // import "github.com/docker/docker/api/server/router/image"

import (
	"github.com/docker/docker/api/server/router"
)

// imageRouter is a router to talk with the image controller
type imageRouter struct {
	backend Backend
	routes  []router.Route
}

// NewRouter initializes a new image router
func NewRouter(backend Backend) router.Router {
	r := &imageRouter{backend: backend}
	r.initRoutes()
	return r
}

// Routes returns the available routes to the image controller
func (r *imageRouter) Routes() []router.Route {
	return r.routes
}

// initRoutes initializes the routes in the image router
func (r *imageRouter) initRoutes() {
	r.routes = []router.Route{
		// GET
		router.NewGetRoute("/images/json", r.getImagesJSON),
		router.NewGetRoute("/images/search", r.getImagesSearch),
		router.NewGetRoute("/images/get", r.getImagesGet),
		router.NewGetRoute("/images/{name:.*}/get", r.getImagesGet),
		router.NewGetRoute("/images/{name:.*}/history", r.getImagesHistory),
		router.NewGetRoute("/images/{name:.*}/json", r.getImagesByName),
		// POST
		router.NewPostRoute("/images/load", r.postImagesLoad),
		router.NewPostRoute("/images/create", r.postImagesCreate),
		router.NewPostRoute("/images/{name:.*}/push", r.postImagesPush),
		router.NewPostRoute("/images/{name:.*}/tag", r.postImagesTag),
		router.NewPostRoute("/images/prune", r.postImagesPrune),
		// DELETE
		router.NewDeleteRoute("/images/{name:.*}", r.deleteImages),
	}
}

package image // import "github.com/docker/docker/api/server/router/image"

import (
	"github.com/docker/docker/api/server/router"
	"github.com/docker/docker/image"
	"github.com/docker/docker/layer"
	"github.com/docker/docker/reference"
)

// imageRouter is a router to talk with the image controller
type imageRouter struct {
	backend          Backend
	referenceBackend reference.Store
	imageStore       image.Store
	layerStore       layer.Store
	routes           []router.Route
}

// NewRouter initializes a new image router
func NewRouter(backend Backend, referenceBackend reference.Store, imageStore image.Store, layerStore layer.Store) router.Router {
	r := &imageRouter{
		backend:          backend,
		referenceBackend: referenceBackend,
		imageStore:       imageStore,
		layerStore:       layerStore,
	}
	r.initRoutes()
	return r
}

// Routes returns the available routes to the image controller
func (r *imageRouter) Routes() []router.Route {
	return r.routes
}

// initRoutes initializes the routes in the image router
func (r *imageRouter) initRoutes() {
	r.routes = []router.Route{
		// GET
		router.NewGetRoute("/images/json", r.getImagesJSON),
		router.NewGetRoute("/images/search", r.getImagesSearch),
		router.NewGetRoute("/images/get", r.getImagesGet),
		router.NewGetRoute("/images/{name:.*}/get", r.getImagesGet),
		router.NewGetRoute("/images/{name:.*}/history", r.getImagesHistory),
		router.NewGetRoute("/images/{name:.*}/json", r.getImagesByName),
		// POST
		router.NewPostRoute("/images/load", r.postImagesLoad),
		router.NewPostRoute("/images/create", r.postImagesCreate),
		router.NewPostRoute("/images/{name:.*}/push", r.postImagesPush),
		router.NewPostRoute("/images/{name:.*}/tag", r.postImagesTag),
		router.NewPostRoute("/images/prune", r.postImagesPrune),
		// DELETE
		router.NewDeleteRoute("/images/{name:.*}", r.deleteImages),
	}
}

This signature is a bit "odd"; `NewRouter()` is exported, but the arguments it takes are non-exported interfaces; should those be exported, or should this take the interfaces that they already implement? (i.e. `image.Store`, `reference.Store`? 🤔 