简体   繁体   中英

Put dockerfile at top level folder of solution

I have a Visual Studio solution with two projects. I would like to have the Dockerfile at the same level as my solution file (sln) instead of having it inside my API project (default behavior). I have tried several options, even adding to my API project:

<PropertyGroup>
    <DockerfileContext>../Dockerfile</DockerfileContext>
</PropertyGroup>

However, Visual Studio is complaining "Error CTC1023 No Dockerfile could be found. Please make sure you have a Dockerfile called 'Dockerfile' adjacent to the project file"

Is it possible to have Docker integration with Visual Studio and place dockerfile at sln level?

Ok, I found the answer, will post it just in case someone face the same situation.

I added the following attribute in the API project csproj file:

<PropertyGroup>
    <!--Other properties ... -> 
    <DockerfileFile>../Dockerfile</DockerfileFile>
 </PropertyGroup>

Where ../Dockerfile is the relative path to the dockerfile from the main project. Now it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM