microsoft / vscode-docker

Docker Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker
Other
1.18k stars 508 forks source link

Multi stage build dockerfile with requirements-stage line showing false error #4240

Closed Avin-Mathew closed 4 months ago

Avin-Mathew commented 4 months ago

I am using a dockerfile with multi-stage build, I am getting what I believe is a false warning for the line

# Stage 1: Build the requirements
FROM python:3.10 as requirements-stage
....................................................................
rest of the logic
....................................................................
# Stage 2: Build the final image
FROM python:3.10

in this the first line "FROM python:3.10 as requirements-stage" shows the error

[dockerfile-validator] Invalid parameters for command.: "FROM python:3.10 as requirements-stage" https://docs.docker.com/engine/reference/builder/

danegsta commented 4 months ago

Make sure you’re uppercasing any keywords in the Dockerfile: FROM python:3.10 AS requirements-stage. Capitalizing AS should hopefully fix the error.

Avin-Mathew commented 4 months ago

@danegsta no it does't, still the same.

danegsta commented 4 months ago

Can you make sure you don’t have any extra Dockerfile linter extensions installed? That error looks like it may be coming from a different extension, dockerfile-validator.

Avin-Mathew commented 4 months ago

yes you were right it was from the extension dockerfile-validator, thanks for the replies.