Docker (Part 2) - Docker Compose with .Net Core MVC and API

Sample application (.Net Core MVC + .Net Core API) integration sample with Docker Compose.

Docker Compose File Format Versions

Create Docker Images and Containers Sample CLI Commands
#1. Create webapi Image
docker build –tag dotnetcoredemo:webapi –file .ServicesAPIDNCD.Service.APIDockerfile .
#2. Create mvc image
docker build –tag dotnetcoredemo:mvc –file .ProjectDNCD.Project.PortalDockerfile .
#3. Create a local network
docker network create –driver nat demo-mynetwork
#4. Create container1
docker run –name main-api –publish 3333:80 –network demo-network1 dotnetcoredemo:webapi
#5. Create container1
docker run –name main-mvc -it –publish 3336:80 –network demo-network1 dotnetcoredemo:mvc

Docker Host to use Wifi Adapter
“dns”: [ “”, “” ]

Docker View Tools
1. Visual Studio 2019 (Go to Views menu – Other Windows – Containers) – Recommended
1. Powershell ISE
2. Visual Studio Code with Extension ‘Docker’
3. Docker Desktop Dashboard


Avatar of Munaga

By Munaga

16 thoughts on “Docker (Part 2) – Docker Compose with .Net Core MVC and API”
  1. Munaga gaaru, staging ani yenduku pettaru ? just to show we can mention in which environment you wanted to depoy ani ? but how does it signifies the name of the environment ? finally it should run kadandi. Can you please help us to understand on this front. Thanks much in advance.

  2. Hi Venky,

    While am running docker-compose its throwing a below error.
    docker-compose : The Compose file '.docker-compose.yml' is invalid because:

    At line:1 char:1

    + docker-compose up

    + ~~~~~~~~~~~~~~~~~

    + CategoryInfo : NotSpecified: (The Compose fil…nvalid because::String) [], RemoteException

    + FullyQualifiedErrorId : NativeCommandError
    Could you please help me reg this error. If you don't mind please reply on this.

    Thanks in Advance.

  3. There are many good docker tutorials, but this one and Part I are the best Docker tutorials for .Net developers. Munaga Venkat is a great teacher. Thank your Sir, Keep it up!

  4. Really awesome 👌 content, don't know why this guy is so underrated..😲 Great work… keep going. This will be best tech channel in upcoming time… one advice break this as more bigger series with smaller videos..

Leave a Reply

Your email address will not be published.

Captcha loading...