Consider this to be a .NET companion to the [Dapr Self-Hosted with Docker Guide]({{ ref self-hosted-with-docker.md }})).
docker-compose
is a CLI tool included with Docker Desktop that you can use to run multiple containers at a time. It is a way to automate the lifecycle of multiple containers together, and offers a development experience similar to a production environment for applications targeting Kubernetes.
docker-compose
manages containers for you, you can make dependencies part of the application definition and stop the long-running containers on your machine.From the .NET perspective, there is no specialized guidance needed for docker-compose
with Dapr. docker-compose
runs containers, and once your service is in a container, configuring it similar to any other programming technology.
--app-port
later.To summarize the approach:
Dockerfile
for each servicedocker-compose.yaml
and place check it in to the source code repositoryTo understand the authoring the docker-compose.yaml
you should start with the Hello, docker-compose sample.
Similar to running locally with dapr run
for each service you need to choose a unique app-id. Choosing the container name as the app-id will make this simple to remember.
The compose file will contain at a minimum:
<service>-daprd
sidecar container with the service’s port and app-id specifiedYou can also view a larger example from the eShopOnContainers sample application.