Skip to content

Support using existing Docker images as hooks #597

@jsok

Description

@jsok

Currently a language: docker hook only supports running a Docker image which it built itself (via a Dockerfile).

However this seems a little unnecessary and expensive since we can and should be building and publishing our Docker images to a registry.

Would there be interest in supporting using existing images as hooks? It should be simple and I'd be happy to make the PR.

Proposed .pre-commit-hooks.yaml change

-   id: flake8-docker
    name: flake8 (via docker)
    description: flake8, but provided by docker
    files: \.py$

    language: docker
    # Image to `docker pull`
    docker_image: my.registry.example.com/pre-commit-hooks/flake8:latest
    # Optional: use `ENTRYPOINT` of the image if not specified
    entry: flake8

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions