Skip to content

Missing tag rule should not apply to local multistage Dockerfiles #187

@iskandersierra

Description

@iskandersierra

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions