Fix Dockerfile linter warnings #1042

Closed
opened 2026-04-06 01:34:11 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @dfunkt on 7/17/2024

  • they seem to have started appearing with buildx v0.16.0

Alpine warnings:

13 warnings found (use --debug to expand):
 - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" (line 37)
 - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" (line 38)
 - RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior (line 133)
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 35)
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 36)
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 42)
 - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" (line 29)
 - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" (line 36)
 - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" (line 42)
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 29)
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 34)
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 37)
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 38)

Debian warnings:

5 warnings found (use --debug to expand):
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 29)
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 38)
 - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" (line 29)
 - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" (line 34)
 - RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior (line 171)

For FromPlatformFlagConstDisallowed I decided to use the 3rd variant from here:
https://github.com/moby/buildkit/blob/master/frontend/dockerfile/linter/docs/FromPlatformFlagConstDisallowed.md#description

*Originally created by @dfunkt on 7/17/2024* - they seem to have started appearing with buildx v0.16.0 Alpine warnings: ``` 13 warnings found (use --debug to expand): - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" (line 37) - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" (line 38) - RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior (line 133) - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 35) - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 36) - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 42) - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" (line 29) - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" (line 36) - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" (line 42) - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 29) - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 34) - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 37) - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 38) ``` Debian warnings: ``` 5 warnings found (use --debug to expand): - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 29) - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 38) - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" (line 29) - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" (line 34) - RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior (line 171) ``` For ```FromPlatformFlagConstDisallowed``` I decided to use the 3rd variant from here: https://github.com/moby/buildkit/blob/master/frontend/dockerfile/linter/docs/FromPlatformFlagConstDisallowed.md#description
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/vaultwarden#1042