How do I make a comment in a Dockerfile?

前端 未结 7 1154
悲&欢浪女
悲&欢浪女 2021-01-29 20:21

I am writing a Dockerfile. Is there a way to make comments in this file?

Does Docker have a comment option that takes the rest of a line and ignores it?

7条回答
  •  萌比男神i
    2021-01-29 20:47

    Format

    Here is the format of the Dockerfile:

    We can use # for commenting purpose#Comment for example

    #FROM microsoft/aspnetcore
    FROM microsoft/dotnet
    COPY /publish /app
    WORKDIR /app
    ENTRYPOINT ["dotnet", "WebApp.dll"]
    

    From the above file when we build the docker, it skips the first line and goes to the next line because we have commented it using #

提交回复
热议问题