Comments (6)
Found this issue after discovering there's no multistage support.
For anyone that needs such a thing, consider the alternative linter hadolint.
from dockerfilelint.
@SimonHeimberg I checked the Dockerfile posted by @AuthorProxy and the one I posted as an example in http://www.dockerfilelint.com and noticed that the line FROM base AS dependencies
gives a warning because of the FROM <any_image>:<tag>
is correctly using the image base
but it doesn't have a tag associated to it.
dockerfilelint
must be thinking that base
is a published image and using the latest tag (assumed because the tag is not present) is not recommended.
The bug could be summarized into: When reusing stages with the FROM
directive in a multistage Dockerfile, dockerfilelint gives a false positive warning for not having a tag associated to it.
from dockerfilelint.
@darkvertex Thanks!. The multistage Dockerfile I used as an example before shows no warnings on the online version of hadolint.
from dockerfilelint.
There are two online checkers using this tool:
- https://www.fromlatest.io/#/ , the original one, which is outdated
- http://www.dockerfilelint.com/#/ , which uses a newer version of this tool. It supports multistage dockerfiles
But the other problem:
Both ask for a tag for line 15 (FROM base AS dependencies
), which does not make sense (at least probably) because base is defined in the dockerfile. This also happens on version 1.5.0 running locally. The alternative hadolint does not have this problem.
from dockerfilelint.
@AmauryOrtega Thanks for this nice summary. I can confirm your findings.
from dockerfilelint.
@AuthorProxy This warning appears because you don't specify the tag on the FROM
statements.
An example for a multistage build that doesn't show those warnings:
FROM node:8.4.0-slim as clientbuilder
WORKDIR /app
COPY src/main/frontend .
RUN yarn
RUN npm run build
FROM openjdk:8u141-jdk-slim as serverbuilder
WORKDIR /app
COPY . .
COPY --from=clientbuilder /app/dist /app/src/main/resources/static
RUN ./gradlew build
FROM openjdk:8-jre-alpine
ENV artifact app-0.0.1.jar
WORKDIR /app
COPY --from=serverbuilder /app/build/libs/${artifact} /app
EXPOSE 8080
ENTRYPOINT ["sh", "-c"]
CMD ["java -jar ${artifact}"]
In this case, the warning that appears are:
- Line 8: First Command Must Be FROM (Possible Bug)
- Line 15: First Command Must Be FROM (Possible Bug)
This is expected since there is no multistage support.
from dockerfilelint.
Related Issues (20)
- I want to use "apt update"
- Escaped quotes cause TypeError
- Invalid Argument for HEALTHCHECK HOT 7
- Please create a release HOT 6
- Add Support for Custom Rulesets
- Ability to supply "Severity" levels for rules
- Repo still actively maintained? HOT 2
- "Label Is Invalid" when period in label key
- Add support for yum commands
- Dead link for no-install-recommends
- Multi-Stage builds incorrectly expect a version label
- [v1.8.0] Rules ignored HOT 1
- Configuration file path enhancement HOT 1
- Missing tag rule should not apply to local multistage Dockerfiles HOT 6
- Invalid Port Exposed error HOT 1
- Active status & maintainers ? HOT 1
- Feature Request: Add Rule for EOF return
- Complaints of Base Image Missing Tag when tag is specified for Python
- Wrong error when creating a docker file that is using a base image from an argument
- Does not recognize error in wrong EXPOSE statement with a list of ports with a comma, e.g. "EXPOSE 8080, 8443" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dockerfilelint.