---
title: "Development with Docker Containers for MVC"
description: "ASP.NET Zero is the base solution for building robust and scalable web applications. Unlock your full potential today!"
url: "https://aspnetzero.com/blog/development-with-docker-containers-for-mvc"
image: "https://aspnetzero.com/Images/Blog/development-with-docker-containers-for-mvc.png"
---

[Blog](https://aspnetzero.com/blog)

# Development with Docker Containers for MVC

02 March 2022 4 min read [MVC](https://aspnetzero.com/blog/topics/mvc) [Docker](https://aspnetzero.com/blog/topics/docker)

![Development with Docker Containers for MVC](https://aspnetzero.com/Images/Blog/development-with-docker-containers-for-mvc.png)

Share [X](https://twitter.com/intent/tweet?url=https%3A%2F%2Faspnetzero.com%2Fblog%2Fdevelopment-with-docker-containers-for-mvc&text=Development+with+Docker+Containers+for+MVC) [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Faspnetzero.com%2Fblog%2Fdevelopment-with-docker-containers-for-mvc) [Reddit](https://reddit.com/submit?url=https%3A%2F%2Faspnetzero.com%2Fblog%2Fdevelopment-with-docker-containers-for-mvc&title=Development+with+Docker+Containers+for+MVC) [Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Faspnetzero.com%2Fblog%2Fdevelopment-with-docker-containers-for-mvc&t=Development+with+Docker+Containers+for+MVC)

# Development with Docker Containers for MVC

In this article, we will dive into the world of Docker **containers** and **demonstrate** how you can utilize them to enhance your MVC development **workflow**. We will explore topics such as containerizing the **MVC** application, managing dependencies with **Docker Compose**, and **orchestrating** development efficiently.

ASP.NET Zero `aspnet-core` folder contains various docker projects for your application to **debug** using **docker** containers. You can add these projects to your **.Web** or **.All** solutions by **Add Existing Project** to your preferred solution.

![docker-projects-folder-core-mvc](https://aspnetzero.com/Images/Blog/docker-projects-folder-core-mvc.png)

To get started with using docker for development, there are some prerequisites.

## Setting up the Infrastructure

Infrastructure contains **mssql-server-linux** as a replacement for your **LocalDb** and **redis** server for your applications.

In your `aspnet-core\docker\infrastructure\` folder, you will find `run-infrastructure.ps1` file which uses `docker-compose.infrastructure.yml` file to setup your infrastructure. Running the shell script should have a similar output like below.

![docker-infrastructure-run](https://aspnetzero.com/Images/Blog/docker-infrastructure-run.png)

After running the script, powershell will be hanging (non interactive) for you to see if there is any error occurred while creating the containers. You can use **Ctrl + X** to exit tailing the database logging to make the powershell interactive again.

## Setting up the self-signed Certificate

Your applications need certificate to enable https. Normally **Visual Studio** creates this **certificate** for you when you run your application for the first time however sometimes it doesn't when docker is involved. To overcome the issue, we create our own **self-signed certificate** for development.

In your `aspnet-core\docker\certificate\` folder, you will find `create-certificate.ps1` file to create the certificate. After running the shell script, you should have a similar output like below.

![docker-create-dev-certificate](https://aspnetzero.com/Images/Blog/docker-create-dev-certificate.png)

## Running the Migrator

In your `aspnet-core\docker\migrator\` folder, you will find `run-migrator` file to apply migrations for your application. Running the shell script should have a similar output like below.

![docker-migrate](https://aspnetzero.com/Images/Blog/docker-migrate.png)

## Running Applications on Containers

In your applications **.Web** solution under **docker folder**, set as startup project you want to debug. Visual studio will instantly begin building the container. **Building containers may take some time** for the first time since it will be downloading required base images.

Below you can see **docker-compose-mvc** debugging:

![docker-mvc-running](https://aspnetzero.com/Images/Blog/docker-mvc-running.png)

There are three docker solutions you can set as startup project to run;

1. **docker-compose-host:** Runs Web.Host project.
2. **docker-compose-mvc:** Runs only Web.Mvc project.
3. **docker-compose-public:** Runs Web.Mvc and Web.Public projects together.

Each docker-compose files have `override.yml` files to set the other environments like certification information, docker volumes or ASP.NET Core environment.

![docker-override-configuration](https://aspnetzero.com/Images/Blog/docker-override-configuration.png)

Configuration is separated between **docker development** and default **IIS development**.

If you want to change the default connection string when running on containers; you need to change the environment variable **ConnectionStrings\_\_Default** in corresponding `docker-compose.yml` shown below:

![docker-cs-configuration](https://aspnetzero.com/Images/Blog/docker-cs-configuration.png)

This environment variable overrides the connection string which has been set in `appsettings.json`. This way you can use both development environments without mixing up the configurations.

In some cases, you may get **container conflict errors** when switching between docker projects; like debugging **docker-compose-mvc** first then start debugging **docker-compose-public** after stopping the first one.

![docker-cs-configuration](https://aspnetzero.com/Images/Blog/docker-container-conflict.png)

This occurs because the mvc container is still alive even if you stop debugging. To avoid container conflicts, you need to **Clean** the solution (right click to docker project and clean option) to remove the container completely before running the **docker-compose-public** which uses common containers like mvc container.

**Note:** You can also run your projects using following commands

*mvc*

```shell
docker compose -f docker-compose-mvc.yml -f docker-compose-mvc.override.yml up
```

*host*

```shell
docker compose -f docker-compose-host.yml -f docker-compose-host.override.yml up
```

*public*

```shell
docker compose -f docker-compose-public.yml -f docker-compose-public.override.yml up
```

## See the full documentation

Explore detailed guides, API references, and step-by-step tutorials for ASP.NET Zero.

[Browse documentation](https://aspnetzero.com/documents)

## Have questions before purchasing?

Schedule a free consultation with our team to find the right plan for your project.

[Schedule a meeting](https://aspnetzero.com/schedule-meeting)

## You might also like

### [Business Benefits of Using ASP.NET Zero for Enterprise Software Development](https://aspnetzero.com/blog/business-benefits-of-aspnetzero)

11 September 2026

### [Common Mistakes and Errors When Hosting ASP.NET Core Apps](https://aspnetzero.com/blog/common-mistakes-and-errors-hosting-aspnet-core-apps)

26 August 2026

### [Using AutoMapper After Migrating to Mapperly](https://aspnetzero.com/blog/using-automapper-after-migrating-to-mapperly)

04 August 2026

## Recent posts

### [Business Benefits of Using ASP.NET Zero for Enterprise Software Development](https://aspnetzero.com/blog/business-benefits-of-aspnetzero)

11 September 2026

### [Common Mistakes and Errors When Hosting ASP.NET Core Apps](https://aspnetzero.com/blog/common-mistakes-and-errors-hosting-aspnet-core-apps)

26 August 2026

### [Using AutoMapper After Migrating to Mapperly](https://aspnetzero.com/blog/using-automapper-after-migrating-to-mapperly)

04 August 2026

## Start building with ASP.NET Zero

Full source code, premium support, Angular, React & MVC UI options.

[View pricing](https://aspnetzero.com/pricing)

## Topics
