Containerizing an application of multiple startup projects without docker-compose — Visual Studio

Uthpala Pathirana
2 min readJun 6, 2019
Photo by Guillaume Bolduc on Unsplash

If you’re reading this, you have probably faced difficulty in running your project in a container individually with the default Dockerfile provided by Visual Studio as a beginner.

You can add a Dockerfile by simply right clicking on the project > Add > Docker Support. This file will include all the other dependant projects too.

Then when you try to build the image via cmd, from the context of the project, it'll fail as the dependant projects cannot be found from this context. I've seen many answers for this in stackoverflow as to copy the Dockerfile to solution context and build. This actually works but a problem arises when you have multiple startup projects which means multiple Dockerfiles in solution folder which is not practical.

Another issue: I've also encountered low disk space when I tried the above method whereas building through VS or VS Code saved my life from low space!

There are two solutions to overcome this.

  1. Right-click the default Dockerfile and build image. Then you can run a container once this is successful. Easy peasy.

2. Open a cmd from the solution folder and execute the build command but refer the Dockerfile inside the project.

Might keep on writing my experiences with docker :D . Stay tuned!

--

--

Uthpala Pathirana

Someone who loves heavy rain-fall on a night and mild sun shine the following morning. Passion for travelling, reading & dancing. A typical dev.