Skip to content
Learning Microservices with Docker, RabbitMQ and .NET Core
C# Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Tutorial followed to learn Microservices with Docker, .NET Core and RabbitMQ

I followed this tutorial to help me learn the basics of Microservices with RabbitMQ, .NET Core and Docker. I then went through adding a number of the features included in the eShopContainers repository to get the hang of how they're all implemented.

Tutorial and project setup


Additional custom enhancements

I've added a few minor changes of my own in order to test out other components that I'd seen Microsoft's eShopContainer repo.

  • Upgraded to .NET Core 3.0
  • Implemented Azure Key Vault
  • Swagger UI using Swashbuckle
  • Implemented gRPC
  • Implemented Serilog and Seq
  • Webhooks
  • Health checks
  • Retry using Polly
  • GraphQL


  • Create new project: dotnet new webApi -o "publisher_api"
  • Create new solution: dotnet new sln
  • Add project to solution: dotnet sln add publsiher_api/publisher_api.csproj
  • Run project: dotnet run
  • Add a package: dotnet add package Newtonsoft.Json

Docker setup


Dockerfile is used in each microservice to define invidual build settings.
Docker-compose "orchestration" for containers. It allows you to run multi-container applications using docker-compose.yml in the root directory.


  • Build: docker build -t my_publisher_api .
  • Run single container: docker run my_publisher_api
  • Run multi-container: docker-compose up --build
  • View list of containers: docker container ls
  • Inspect container details: docker inspect CONTAINER_ID
  • Stop a single microservice after starting with docker-compose: docker stop {instance-id}
  • View running containers: docker ps
  • Stop all running containers (powershell): docker stop $(docker ps -a -q)
  • Remove all containers (powershell): docker rm $(docker ps -a -q)

Additional info

A default network is created for our application when using docker-compose to launch it. Each container is reachable by other containers and discoverable via a hostname identicaly to the container name. e.g. http://localhost:5001 becomes http://publisher_api:80.

Dockerfile defines the image to create, docker compose defines the container.

RabbitMQ setup

Tutorial: getting-started-with-net-core-docker-and-rabbitmq-part-3-66305dc50ccf

RabbitMQ is used for queueing service messages and decoupling them. Added as a new container to docker-compose.


  • Add client to api: dotnet add package RabbitMQ.Client

Additional info

View the RabbitMQ managment console by browsing to http://localhost:15672

Swagger setup


Additional info

JSON feed: http://localhost/swagger/v1/swagger.json
UI: http://localhost/swagger/index.html

gRPC Setup

GitHub Reference:

Serilog with Seq setup

Github: Docker setup for Seq:

Additional info

UI: http://localhost:5340/#/events Internal Logging Target: http://seq:5341


Tutorial: ngrok:

App received a notification every time a change is made to the repository on Github. Requires ngrok to be running if hosting locally.


Github: Doco:

Used to check liveness and health of services. If using in a real project would probably create as a separate microservice or use the provided docker file. The health checks ui observes each of the provided endpoints and provides a spa to display the result.

Additional info

UI: http://localhost/healthchecks-ui Endpoint to check: http://localhost/hc


Background Info (including service meshes): Doco:

Used to maximise availability and handle scenarios where retry logic may be required.


Tutorial: How to set it all up with ASP.NET Core:

I'd heard that the RSPCA is using Hot Chocolate on Microservices with AWS for their newer projects so I'm trying it out.

Added seq, added mongodb, added to docker-compose.

Additional info

Playground endpoint: http://localhost:5000/playground/ Running locally: dotnet watch --project src/Server/ run Run mongodb locally: docker run --name mongo -p 27017:27017 -d mongo mongod

Twitter Service Initial Tutorial: Data Loader Tutorial: Added graphql logger: Linked logger to SEQ sink.

Sample mutation

mutation { createUser(userInput:{ country: "Australia" name: "tesT" }) { id } }

You can’t perform that action at this time.