replicatedhq / dockerfilelint

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

Invalid Argument for HEALTHCHECK #166

Open jokay opened 3 years ago

jokay commented 3 years ago

When using this HEALTHCHECK in a Dockerfile:

HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=5 \
  CMD wget --spider http://localhost/health || exit 1

I get this linting error from super-linter / dockerfilelint 1.8.0:

File:   /builds/dev/app.test/src/app.test.server/Dockerfile
Issues: 1
Line 60: HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=5 \
Issue  Category      Title                 Description
    1  Possible Bug  Invalid Argument      The arguments to this command are invalid
                     Format]

Any idea on how to fix this?

jokay commented 3 years ago

Related issue #28 & pull request #117.

jokay commented 3 years ago

@egoexpress any idea? :wink:

jokay commented 3 years ago

When removing the option --start-period=15s from the Dockerfile, there won't be any linting error anymore.

egoexpress commented 3 years ago

When removing the option --start-period=15s from the Dockerfile, there won't be any linting error anymore.

Mmmh, ok, seems to be a bug. I'll have a look into it. '--start-period' is a valid option for HEALTHCHECK and is already included in the linting function, so it should work.

egoexpress commented 3 years ago

Found the issue. The regular expression checking the option names doesn't count for the dash in the '--start-period' option. PR #167 fixes this.

jokay commented 3 years ago

Thx for the fix.

lvjp commented 3 years ago

I missed up with issue number... It was #156....