Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXPOSE ports not analysed correctly #78

Closed
martinlobe opened this issue Jul 9, 2017 · 4 comments
Closed

EXPOSE ports not analysed correctly #78

martinlobe opened this issue Jul 9, 2017 · 4 comments

Comments

@martinlobe
Copy link

In the docker expose instruction one can define what protocol too.

e.g.
EXPOSE 80/tcp 3000/udp

This is currently detected as a non valid port. Definition of the protocol is allowed.

This is maybe fixed by that:

  expose_port_valid: function(port) {
    return /^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])(\/tcp|\/udp){0,1}$/.test(port);
  },

This also checks for a valid port in range, since currently 99999999 is also detected as a valid port.

@thomasbiddle
Copy link

Along with this - it would be great to allow a variable to be referenced. I follow the practice of

ENV PORT=3000
EXPOSE $PORT

... (Use in other spots as well, to keep DRY)
Line 18: EXPOSE $PORT
Issue  Category      Title                 Description
    1  Possible Bug  Invalid Port Exposed  Exposing ports should only be valid port numbers.

@marccampbell
Copy link
Member

@thomasbiddle Agreed. Will you open a new issue for the ENV PORT; EXPOSE $PORT pattern? I think we should add this in, but we should also do it correctly and ensure that the env var is set and still a valid value (when possible).

@thomasbiddle
Copy link

@marccampbell Referenced in #86.

@nexdrew
Copy link
Collaborator

nexdrew commented Dec 4, 2017

Closing this as it should be fixed in version 1.3.0+. Please let us know if you still have problems with the "port/proto" syntax.

(Also note that fromlatest.io isn't currently running the latest version of dockerfilelint, see replicatedhq/fromlatest.io#242.)

@nexdrew nexdrew closed this as completed Dec 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants