replicatedhq / dockerfilelint

An opinionated Dockerfile linter.
https://www.fromlatest.io
MIT License
979 stars 84 forks source link

[v1.8.0] Rules ignored #185

Closed llaville closed 2 years ago

llaville commented 2 years ago

Hello,

I've Dockerfiles using multistage syntax with FROM inheritance explained here

When I run following command dockerfilelint Dockerfiles/mods/Dockerfile from root of my project I got these errors

File:   Dockerfiles/mods/Dockerfile
Issues: 4

Line 8: FROM base as builder
Issue  Category      Title                 Description
    1  Clarity       Base Image Missing    Base images should specify a tag to use.
                     Tag

Line 22: FROM builder as build-version-1
Issue  Category      Title                 Description
    2  Clarity       Base Image Missing    Base images should specify a tag to use.
                     Tag

Line 28: FROM build-version-${BUILD_VERSION} as after-condition
Issue  Category      Title                 Description
    3  Clarity       Base Image Missing    Base images should specify a tag to use.
                     Tag

Line 30: FROM after-condition
Issue  Category      Title                 Description
    4  Clarity       Base Image Missing    Base images should specify a tag to use.
                     Tag

As I consider them as valid, I've tried to ignored it (as explained by official doc) with a .dockerfilelintrc config file with such contents:

rules:
  missing_tag: off

But errors are displayed whatever I use or not the config file with -c|--config option.

What did I missed ?

Package was installed as follow ```shell $ nvm use --lts Now using node v14.17.5 (npm v6.14.14) $ npm install -g dockerfilelint /opt/nvm/versions/node/v14.17.5/bin/dockerfilelint -> /opt/nvm/versions/node/v14.17.5/lib/node_modules/dockerfilelint/bin/dockerfilelint + dockerfilelint@1.8.0 added 47 packages from 20 contributors in 7.596s ```
llaville commented 2 years ago

sorry to disturb, I've realized that -c|--config option is only the path to config file excluding base name .dockerfilelintrc

-c, --config   Path for .dockerfilelintrc configuration file                [string]

It works with command dockerfilelint Dockerfiles/mods/Dockerfile --config .

File:   Dockerfiles/mods/Dockerfile
Issues: None found 👍