---
title: Create a Dockerfile for a CMS application
slug: cms-13/docs/create-a-docker-file
docTags: 
createdAt: 2026-07-30T20:22:08.616Z
---

Containerize an Optimizely Content Management System (CMS) 13 application so it deploys consistently across Linux and Windows hosts. This article walks through the Dockerfile, the `.dockerignore` file, and the commands to build and run the image.

## Before you begin

- Docker Desktop installed on your machine.
- A buildable CMS 13 ASP.NET Core application. The project in this example is `episerversample`. See [Install a sample site](docId:2sbZiqkDugL4fjzgpUaDA).
- A chosen container mode (Linux or Windows) in Docker Desktop.

If you are new to ASP.NET, follow the [ASP.NET Get Started tutorial](https://www.asp.net/get-started) to initialize a project, or clone the [ASP.NET Docker Sample](https://github.com/dotnet/dotnet-docker/tree/master/samples/aspnetapp).

## Create a Dockerfile for the application

1. Create a Dockerfile in your project folder.
2. Add the following content to your Dockerfile for Linux or Windows containers. The tags are multi-arch: they pull Windows or Linux containers depending on the mode set in [Docker Desktop for Windows](https://docs.docker.com/docker-for-windows/). See [Switch between Windows and Linux containers](https://docs.docker.com/docker-for-windows/#switch-between-windows-and-linux-containers).

```dockerfile
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build-env
WORKDIR /app

COPY *.csproj ./
RUN dotnet restore

COPY . ./
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:10.0
WORKDIR /app
COPY --from=build-env /app/out .

EXPOSE 80

ENTRYPOINT ["dotnet", "episerversample.dll"]
```

3. The Dockerfile assumes the application is `episerversample`. Change the `ENTRYPOINT` line to reference the DLL of your project.
4. To minimize the build context, add a [`.dockerignore`](https://docs.docker.com/engine/reference/builder/#dockerignore-file) file to your project folder with the following contents:

```text
bin/
obj/
```

## Build and run the Docker image

1. Open a command prompt and go to your project folder.
2. Build the Docker image:

```bash
docker build -t episerversample .
```

3. Run the Docker image:

```bash
docker run -it -e "Urls=http://+:80" -p 8080:80 episerversample
```
