c8d/prune: Fix images being deleted when they're still used with a different reference
- Fixes: https://github.com/moby/moby/issues/45732


**- What I did**
Fixed `image prune -a` deleting dangling images used by containers.

**- How I did it**
-  Exclude dangling tag of the images used by containers (this makes sure that if the original image was deleted we don't delete the dangling image)
-  Exclude images that are used by containers which were started by specifying an image ID instead of a specific name.

**- How to verify it**
```bash
$ make TEST_INTEGRATION_USE_SNAPSHOTTER=1 \
       DOCKER_GRAPHDRIVER=overlayfs \
       TEST_FILTER=TestPruneDontDeleteUsedDangling \
       test-integration
...
INFO: Testing against a local daemon
=== RUN   TestPruneDontDeleteUsedDangling
--- PASS: TestPruneDontDeleteUsedDangling (0.07s)
PASS

DONE 1 tests in 1.079s
```

**- Description for the changelog**
```release-notes
containerd integration: `docker image prune -a` no longer removes images still in use by running containers
```

**- A picture of a cute animal (not mandatory but encouraged)**


integration/image/inspect_test.go
package image

import (
	"context"
	"encoding/json"
	"testing"

	"github.com/docker/docker/testutil/environment"
	"gotest.tools/v3/assert"
	is "gotest.tools/v3/assert/cmp"
	"gotest.tools/v3/skip"
)

// Regression test for: https://github.com/moby/moby/issues/45556
func TestImageInspectEmptyTagsAndDigests(t *testing.T) {
	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "build-empty-images is not called on Windows")
	defer setupTest(t)()

	client := testEnv.APIClient()
	ctx := context.Background()

	danglingId := environment.DanglingImageIdGraphDriver
	if testEnv.UsingSnapshotter() {
		danglingId = environment.DanglingImageIdSnapshotter
	}

	inspect, raw, err := client.ImageInspectWithRaw(ctx, danglingId)
	assert.NilError(t, err)

	// Must be a zero length array, not null.
	assert.Check(t, is.Len(inspect.RepoTags, 0))
	assert.Check(t, is.Len(inspect.RepoDigests, 0))

	var rawJson map[string]interface{}
	err = json.Unmarshal(raw, &rawJson)
	assert.NilError(t, err)

	// Check if the raw json is also an array, not null.
	assert.Check(t, is.Len(rawJson["RepoTags"], 0))
	assert.Check(t, is.Len(rawJson["RepoDigests"], 0))
}

package image

import (
	"context"
	"encoding/json"
	"testing"

	"github.com/docker/docker/testutil/environment"
	"gotest.tools/v3/assert"
	is "gotest.tools/v3/assert/cmp"
	"gotest.tools/v3/skip"
)

// Regression test for: https://github.com/moby/moby/issues/45556
func TestImageInspectEmptyTagsAndDigests(t *testing.T) {
	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "build-empty-images is not called on Windows")
	defer setupTest(t)()

	client := testEnv.APIClient()
	ctx := context.Background()

	danglingID := environment.GetTestDanglingImageId(testEnv)

	inspect, raw, err := client.ImageInspectWithRaw(ctx, danglingID)
	assert.NilError(t, err)

	// Must be a zero length array, not null.
	assert.Check(t, is.Len(inspect.RepoTags, 0))
	assert.Check(t, is.Len(inspect.RepoDigests, 0))

	var rawJson map[string]interface{}
	err = json.Unmarshal(raw, &rawJson)
	assert.NilError(t, err)

	// Check if the raw json is also an array, not null.
	assert.Check(t, is.Len(rawJson["RepoTags"], 0))
	assert.Check(t, is.Len(rawJson["RepoDigests"], 0))
}

Was this meant to go in the first commit? 🙈 

```suggestion
	danglingID := environment.GetTestDanglingImageID(testEnv)
```