Skip to content

Pre-commit hadolint-docker requires docker group added to sudo? #1052

@ddxv

Description

@ddxv
  • This is a bug report
  • This is a feature request
  • I searched existing issues before opening this one

Expected behavior

run pre-commit run --all-files and hadolint-docker runs.

Actual behavior

docker: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock:
 Head "http://%2Fvar%2Frun%2Fdocker.sock/_ping": 
 dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.

Pre-commit.yaml

### DOCKER
  - repo: https://github.com/hadolint/hadolint
    rev: v2.13.1-beta
    hooks:
      - id: hadolint-docker

Question

I believe my issue is that I run docker as sudo docker... and have not added my user to a docker group ie:

$ sudo groupadd docker
$ sudo usermod -aG docker $USER

Is the above an expected step before adding hadolint-docker to pre-commit? If so should I add that, or something similar, to the integration doc?

Additional environment details (OS, stack version, etc.)
Fresh install of Fedora release 41 (Forty One)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions