Summary
We'd like to add support for using immutable image identifiers when pulling images from a v2 registry, creating containers, and running containers.
Background
Use case
When I create a container, I may specify an image such as mysql:latest. When the image is pulled, latest is resolved to a particular image at that point in time. If I later want to add more containers (e.g. possible read slaves in the MySQL case), ideally all the new containers would use the exact same image as my first container. Using a tag isn't sufficient as the tag is mutable.
V2 registry support
As part of distribution/distribution#46, the v2 registry will be adding support for retrieving an image manifest for a particular digest. This feature gives us what we need, as long as the Docker CLI and Engine support it too.
Proposed CLI/Engine changes
We'll need to provide a means to reference an image by its digest. One possible example might be
namespace/repository@digest
We'll need to make sure the following commands continue to work as they currently do, as well as with an optional digest:
docker pull
docker create
docker run
When listing images via docker images, we could default to displaying only the "current" values for each image and tag. An optional flag could enable displaying all values for each image and tag; namely, this would show 1 entry for each image/tag/digest combination.
Questions
What about v1 registry support?
It's not likely we'll be able to support this
If I create an image locally via docker tag or docker commit, can I refer to it by tag + digest?
As proposed in distribution/distribution#46, the registry is responsible for determining an image's digest and assigning it to the image. For an image that has not yet been pushed to a v2 registry, it may not be possible to refer to it by tag + digest. This is unlikely to be a significant issue, as the use case for tag + digest is consistent deployments using images pulled from registries. Or, if the community thinks this should be supported, we can revisit what component(s) are responsible for calculating digests.
Summary
We'd like to add support for using immutable image identifiers when pulling images from a v2 registry, creating containers, and running containers.
Background
Use case
When I create a container, I may specify an image such as
mysql:latest. When the image is pulled,latestis resolved to a particular image at that point in time. If I later want to add more containers (e.g. possible read slaves in the MySQL case), ideally all the new containers would use the exact same image as my first container. Using a tag isn't sufficient as the tag is mutable.V2 registry support
As part of distribution/distribution#46, the v2 registry will be adding support for retrieving an image manifest for a particular digest. This feature gives us what we need, as long as the Docker CLI and Engine support it too.
Proposed CLI/Engine changes
We'll need to provide a means to reference an image by its digest. One possible example might be
We'll need to make sure the following commands continue to work as they currently do, as well as with an optional digest:
docker pulldocker createdocker runWhen listing images via
docker images, we could default to displaying only the "current" values for each image and tag. An optional flag could enable displaying all values for each image and tag; namely, this would show 1 entry for each image/tag/digest combination.Questions
What about v1 registry support?
It's not likely we'll be able to support this
If I create an image locally via
docker tagordocker commit, can I refer to it by tag + digest?As proposed in distribution/distribution#46, the registry is responsible for determining an image's digest and assigning it to the image. For an image that has not yet been pushed to a v2 registry, it may not be possible to refer to it by tag + digest. This is unlikely to be a significant issue, as the use case for tag + digest is consistent deployments using images pulled from registries. Or, if the community thinks this should be supported, we can revisit what component(s) are responsible for calculating digests.