dockerfilelint icon indicating copy to clipboard operation
dockerfilelint copied to clipboard

Add support for ENV $VAR; EXPOSE $VAR pattern

Open thomasbiddle opened this issue 8 years ago • 2 comments

This pattern allows us to define a variable and then re-use it in multiple areas in order to keep our Dockerfile DRY. Under the current implementation; dockerfilelint will state "Invalid Port Exposed"

Somewhat related to #78.

thomasbiddle avatar Sep 12 '17 21:09 thomasbiddle

As a simple example:

FROM nginx:latest

ENV PORT=3000
EXPOSE $PORT

thomasbiddle avatar Oct 11 '17 13:10 thomasbiddle

The current output is:

Line 319: EXPOSE "${service_ports}"
Issue  Category      Title                 Description
    1  Possible Bug  Invalid Port Exposed  Exposing ports should only be valid port numbers.

... which is fine so far as it goes, but there should be a way to hide this warning with a linter ignore= directive.

srcshelton avatar Jan 03 '21 16:01 srcshelton