0

here is my command

docker images --filter  label=my_label=intro2

and output

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              3b3cb3ba4220        45 hours ago        1.34GB

how do I grep the 3b3cb3ba4220 ? also, a general explaination as to how this grep / awk works will be appreciated.

1
docker images --filter label=my_label=intro2 --format "{{.ID}}" 

Not using Docker myself, I can't verify that this work, but this is what the manual says.

The --format option is described in another section of the manual.

0

This might be a little late in the game. However, images with "<none>" as the repository and tag are called dangling images.

This is what Docker's docs have to say about it in the "Show untagged images (dangling)" subsection of the "Filtering" section:

$ docker images --filter "dangling=true"

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              8abc22fbb042        4 weeks ago         0 B
<none>              <none>              48e5f45168b9        4 weeks ago         2.489 MB
<none>              <none>              bf747efa0e2f        4 weeks ago         0 B

This will display untagged images that are the leaves of the images tree (not intermediary layers). These images occur when a new build of an image takes the repo:tag away from the image ID, leaving it as : or untagged. A warning will be issued if trying to remove an image when a container is presently using it. By having this flag it allows for batch cleanup.

The exact command to extract such dangling IDs is provided by Docker. There is no need for grep. Use the following:

docker images --format "{{.ID}}" --filter "dangling=true"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.