Docker images: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 44: Line 44:


This is how to [[Remove Dangling Docker Images#Procedure|remove dangling images]].
This is how to [[Remove Dangling Docker Images#Procedure|remove dangling images]].
=Check Whether a Specific Image Exists in the Repository=
docker images -q artifacts.example.com/myapp:1.0
will return the hash if exists, empty string otherwise.

Revision as of 21:07, 4 September 2019

External

Internal

Overview

List images in the local Docker registry.

docker images [image-name]
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
db                  latest              c0e4c08c3981        3 minutes ago       624.1 MB
rabbitmq            latest              3bb7a967fc6c        7 days ago          179.4 MB

Options

-f, --force

Forces removal. This is necessary if the image is referenced from multiple repositories.

--format

Uses a Go template:

docker images --format "{{.ID}}"
docker images --format "{{.ID}}, {{.Tag}}"

--no-trunc

Don't truncate output.

-q, --quiet

Only show numeric IDs.

Dangling Images

docker images --filter "dangling=true"

This is how to remove dangling images.

Check Whether a Specific Image Exists in the Repository

docker images -q artifacts.example.com/myapp:1.0

will return the hash if exists, empty string otherwise.