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

Multiple ENTRYPOINT/CMD/HEALTHCHECK warnings invalid in the context of a multi-stage Dockerfile #22

Closed
hairyhenderson opened this issue Feb 17, 2018 · 8 comments
Assignees
Labels

Comments

@hairyhenderson
Copy link

// more than one ENTRYPOINT found, warn the user

When using a multi-stage Dockerfile, these warnings trigger, but shouldn't. I suppose a possible way to fix this would be to reset the counts when a FROM instruction is encountered...

@rcjsuen rcjsuen changed the title Multiple ENTRYPOINT/CMD warnings invalid in the context of a multi-stage Dockerfile Multiple ENTRYPOINT/CMD/HEALTHCHECK warnings invalid in the context of a multi-stage Dockerfile Feb 17, 2018
@rcjsuen rcjsuen added the bug label Feb 17, 2018
@rcjsuen
Copy link
Owner

rcjsuen commented Feb 17, 2018

Thank you very much for your bug report, @hairyhenderson. We should fix this for CMD, ENTRYPOINT, and HEALTHCHECK.

FROM alpine
CMD ls
FROM alpine
CMD pwd
$ dockerfile-utils lint Dockerfile
Line: 2
CMD ls
^^^
Warning: There can only be one CMD instruction in a Dockerfile

Line: 4
CMD pwd
^^^
Warning: There can only be one CMD instruction in a Dockerfile
FROM alpine
ENTRYPOINT ls
FROM alpine
ENTRYPOINT pwd
$ dockerfile-utils lint Dockerfile
Line: 2
ENTRYPOINT ls
^^^^^^^^^^
Warning: There can only be one ENTRYPOINT instruction in a Dockerfile

Line: 4
ENTRYPOINT pwd
^^^^^^^^^^
Warning: There can only be one ENTRYPOINT instruction in a Dockerfile
FROM alpine
HEALTHCHECK CMD ls
FROM alpine
HEALTHCHECK CMD pwd
$ dockerfile-utils lint Dockerfile
Line: 2
HEALTHCHECK CMD ls
^^^^^^^^^^^
Warning: There can only be one HEALTHCHECK instruction in a Dockerfile

Line: 4
HEALTHCHECK CMD pwd
^^^^^^^^^^^
Warning: There can only be one HEALTHCHECK instruction in a Dockerfile

@rcjsuen rcjsuen self-assigned this Feb 17, 2018
@rcjsuen
Copy link
Owner

rcjsuen commented Feb 17, 2018

Fixed by 06de6f9 but I wrote the wrong issue number in the commit message. :(

@rcjsuen rcjsuen closed this as completed Feb 17, 2018
@hairyhenderson
Copy link
Author

Thanks @rcjsuen! That was fast 😂

@rcjsuen
Copy link
Owner

rcjsuen commented Feb 18, 2018

@hairyhenderson No problem, thank you for opening the bug report! Would you like me to publish a new version to npm?

@hairyhenderson
Copy link
Author

@rcjsuen yes please - I mainly use this through VSCode, so maybe more downstream things need to be updated as well... No huge rush though :)

@rcjsuen
Copy link
Owner

rcjsuen commented Feb 18, 2018

@hairyhenderson Ah. Yeah, then it'll take a while. :P

I'd have to trickle this change to my own downstream projects in addition to getting the dependency updated in the vscode-docker extension. And then the Microsoft guys would have to also agree to publish a new version to the Visual Studio Marketplace. :O

You must have done quite some detective work to get this far down the dependency chain though. Most people just open a bug in the vscode-docker extension and call it a day. ;)

If you are using VS Code though, you can disable the validation by modifying your settings. Naturally, this has the side effect of disabling the correct validation warning where multiples of these instructions appear in the same build stage...

{
    "docker.languageserver.diagnostics.instructionCmdMultiple": "ignore",
    "docker.languageserver.diagnostics.instructionEntrypointMultiple": "ignore",
    "docker.languageserver.diagnostics.instructionHealthcheckMultiple": "ignore"
}

@rcjsuen
Copy link
Owner

rcjsuen commented May 21, 2018

@hairyhenderson This should now be fixed with the latest 0.0.27 release of the Docker extension.

@hairyhenderson
Copy link
Author

woot! Thanks @rcjsuen 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants