Image and Container Metadata

From NovaOrdis Knowledge Base
Revision as of 19:33, 2 January 2021 by Ovidiu (talk | contribs) (→‎User)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

External

Internal

Overview

Generated with docker inspect, in the form of a JSON array.

The metadata has different semantics whether it was generated for an image or a container, as described below. Metadata for containers must provide all of the runtime configurations needed to start and restart the image with all of its settings intact.

Elements

Id

For images, the unique identifier of the image. Also see Image ID.

For containers, the unique identifier of the container.

"Id": "sha256:6902f4d604b94bddc603cba267ac61fb86c7602d121fa7cdd0c1f2526897a32e"

Parent

For images, the identifier of the parent image. The parent image is the image used in the FROM instruction of the Dockerfile that was used to build the image.

There are situations when the 'Parent' value is NOT the Id of the image specified as "FROM". That happens when intermediate images are created during the image build process.

Containers do not have parents.

RepoTags

"RepoTags": [ "registry.access.redhat.com/rhscl/postgresql-95-rhel7:latest" ]

RepoDigests

"RepoDigests": [ "registry.access.redhat.com/rhscl/postgresql-95-rhel7@sha256:33888776920331bc37ae17692bac043210305aa35ed444cf5eded89f8311d0d7"  ]

Comment

Created

"Created": "2017-11-22T15:23:09.730226Z"

Container

For an image, it may contain the identifier of the temporary container created when the image was built. Docker will create a container during the image construction process, and its identifier will be stored in the image metadata.

Config

For an image, it refers to the runtime configuration requirements.

For a container, it contains the runtime configuration options set when the docker run command was executed.

Hostname

Domainname

User

"Config": {
  "User": "<UID>:<GID>"
}

See:

Dockerfile USER

AttachStdin

AttachStdout

AttachStderr

ExposedPorts

Tty

OpenStdin

StdinOnce

Env

A list containing environment variable definitions:

"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"container=oci",
...

Cmd

The content of the CMD instruction from the Dockerfile that was used to create the image.

CMD /opt/loop

translates to:

"Cmd": [
  "/bin/sh",
  "-c",
  "/opt/loop"
]

ArgsEscaped

Image

Volumes

Specifies the definition of in-container data volume mount points. These are not bound until runtime, when the binding information is specified by

"Config": {
    "Volumes": {
       "/var/lib/pgsql/data": {}
    },
}

WorkingDir

Entrypoint

OnBuild

Labels

ContainerConfig

For an image, it refers to the temporary container created when the docker build command was executed.

Hostname

Domainname

User

AttachStdin

AttachStdout

AttachStderr

ExposedPorts

Tty

OpenStdin

StdinOnce

Env

Cmd

ArgsEscaped

Image

Volumes

WorkingDir

Entrypoint

OnBuild

Labels

DockerVersion

For an image, it contains the version of Docker used to create the image.

Author

Architecture

Os

Size

VirtualSize

For an image, the size of the image in bytes.

GraphDriver

Mounts

The data volume mounts.

"Mounts": [
            {
                "Type": "bind",
                "Source": "/data-volumes/postgresql",
                "Destination": "/var/lib/pgsql/data",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
       ],

RootFS

Type

"Type": "layers"

Layers

[
  "sha256:e1d829eddb62dc49f1c56dbf8acd0c71299b3996115399de853a9d66d81b822f",
  "sha256:02404b4d7e5d89b1383ca346b4462b199128aa4b238c5a2b2c186004ac148ba8",
  "sha256:808f296bc8ac99056e0cbba79e2b253fff2c3c963927be1a9acd182bbc90538e"
]

State

It only shows for containers. It contains various status flags and the process id for the container.

Image

It only shows for containers. It contains the Id of the image this container is running.

NetworkSettings

It only shows for containers. It contains the network environment for the container.

LogPath

It only shows for containers. It contains the system path to this container's log file.

RestartCount

It only shows for containers. It keeps track of the number of times the container has been restarted.

Name

It only shows for containers. It contains the user defined name for the container.

Volumes

It only shows for containers. It defines the volume mapping between the host system and the container.

HostConfig

It only shows for containers. It contains configuration for how the container will interact with the host system. Includes CPU and memory limits, networking values, or device driver paths.

Mounts

The data volume mounts.

"HostConfig": {
    "Mounts": [
                {
                    "Type": "bind",
                    "Source": "/data-volumes/postgresql",
                    "Target": "/var/lib/pgsql/data"
                }
              ]
}

Memory

/sys/fs/cgroup/memory/memory.limit_in_bytes

Memory limit in OpenShift.