Skip to content

[FEAT] Sub-command for locking/pinning images to digests with lock-file support for the compose command in general #12836

Closed

Description

@andoks

Description

Currently, if one wants to ensure supply-chain security with regards to use of docker images in docker-compose files, users have to specify the digest manually in the compose file.

Previously there was a project (docker-lock) that could automate this, but this project has been deleted.

It would be great if docker-compose supported pinning images to digest, somewhat like npm lock-files, python lock-files and go sum-file.

If docker-compose could also support updating said images digest upon request, that would be great too, but that would not be necessary for a Minimal Viable Product version of the feature IMO, as long as i can request a "re-lock" from compose that updates the digests in the assumed new lock-file, when I have updated the tag in the compose-file

Activity

  1. changed the title [-][FEAT] Support locking/pinning images to digests[/-] [+][FEAT] Sub-command locking/pinning images to digests with lock-file support for the compose command in general[/+] on May 15, 2025
  2. changed the title [-][FEAT] Sub-command locking/pinning images to digests with lock-file support for the compose command in general[/-] [+][FEAT] Sub-command for locking/pinning images to digests with lock-file support for the compose command in general[/+] on May 15, 2025
  3. ndeloof commented on May 16, 2025

    @ndeloof
    Contributor

    You can rely on docker compose config --resolve-image-digests to fix image digest.
    Then som yq trickery can be used to generate an override file that will only contain the image references

    $ docker compose config --resolve-image-digests | yq '{"services": (.services|to_entries|.[]|{.key: {"image": .value.image}})}'
    
    services:
      test:
        image: docker.io/library/alpine:latest@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c
    

    This feature is actually already implemented in Docker Compose for the benefits of the publish command, so maybe we could expose it as docker compose config --image-digests

  4. andoks commented on Sep 24, 2025

    @andoks
    Author

    Relates to #5818

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions