dockerfilelint icon indicating copy to clipboard operation
dockerfilelint copied to clipboard

Missing tag rule should not apply to local multistage Dockerfiles

Open iskandersierra opened this issue 2 years ago • 6 comments

Using project mega-linter, I get the following error:

    Line 16: FROM build AS publish
    Issue  Category      Title                 Description
        1  Clarity       Base Image Missing    Base images should specify a tag to use.
                         Tag

on the following Dockerfile:

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
...

FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
...

FROM build AS publish # This is the offender line
...

FROM base AS final # This is an offender line as well
...

This makes me disable the rule missing_tag, which I want enabled for the first two stages, in order to pass the test.

Is this behaviour intended or is it possible to check whether there is a previous stage with the name being checked and skip that validation?

Thanks for the good work. If you accept PRs I could check if I can do this update.

iskandersierra avatar Oct 06 '21 10:10 iskandersierra

I had similar issue, here the link to it. https://github.com/megalinter/megalinter/issues/1053 curious if you have a workaround

sbollap1 avatar Dec 01 '21 19:12 sbollap1

I have the same issue here for local multi stages. It would be nice to have a general option to disable any rule(s) using comment #dockerfilelint disable=missing_tag.

tymonx avatar Jan 04 '22 10:01 tymonx

Any update on this?

ankitbko avatar Mar 07 '22 11:03 ankitbko

I just ran into the same issue.

jamescanady avatar May 05 '22 18:05 jamescanady

Just did bump into the same issue, is there really no way to add an ignore statement like the one suggested above? This would help to "workaround" the problem until it will eventually be supported.

Currently I end up disabling the linter for a whole file, and that's sad because we loose valuable feedback from it.

johbo avatar Nov 23 '22 08:11 johbo

Just encountered this 2.5 years later.

skull-squadron avatar Apr 07 '24 00:04 skull-squadron