Docker images: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Client Operations =Overview=")
 
 
(26 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
* https://docs.docker.com/engine/reference/commandline/images/
=Internal=
=Internal=


* [[Docker Client Operations#exec|Client Operations]]
* [[Docker_Client_Operations#List_Images|Image Operations]]


=Overview=
=Overview=
List images in the [[Docker_Concepts#Local_Image_Registry|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=
==<tt>-f</tt>, <tt>--force</tt>==
Forces removal. This is necessary if the image is referenced from multiple repositories.
==<tt>--format</tt>==
Uses a Go template:
docker images --format "&#123;{.ID}}"
docker images --format "&#123;{.ID}}, &#123;{.Tag}}"
==<tt>--no-trunc</tt>==
Don't truncate output.
==<tt>-q</tt>, <tt>--quiet</tt>==
Only show numeric IDs.
==<tt>-f</tt>, <tt>--filter</tt>==
Filter output based on conditions provided.
Regular expressions applied to <registry>:<tag>
<syntaxhighlight lang='bash'>
docker images --filter=reference=docker.com/ovidiu_feodorov/automation-agent:*pre*
</syntaxhighlight>
Filter by time <code>before=<some-image></code>, <code>since=<some-image></code>:
<syntaxhighlight lang='bash'>
docker images --filter=before=docker.com/ovidiu_feodorov/automation-agent:0.1.0-pre.10
</syntaxhighlight>
=Dangling Images=
docker images --filter "dangling=true"
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.

Latest revision as of 08:03, 4 May 2022

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.

-f, --filter

Filter output based on conditions provided.

Regular expressions applied to <registry>:<tag>

docker images --filter=reference=docker.com/ovidiu_feodorov/automation-agent:*pre*

Filter by time before=<some-image>, since=<some-image>:

docker images --filter=before=docker.com/ovidiu_feodorov/automation-agent:0.1.0-pre.10

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.