Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 788
Oscar Avatar asked Sep 14 '25 10:09

Oscar


1 Answers

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.

like image 57
Oscar Avatar answered Sep 16 '25 23:09

Oscar