Dockerfile/ Docker Compose for multiple projects with different ports

I need your suggestions to architect a solution. I have a solution(.NET Core) with 5 API projects.

Solution 
   Project 1
   Project 2 
   Project 3 
   Project 4 
   Project 5 

which runs on different ports, Like

http://localhost:10500/api/values , 
http://localhost:10501/api/values .. so on
http://localhost:10504/api/values

(Only the post number changes )

Requirement is to dockerize this solution and run in Kubernetes cluster via Kube Ingress, what is better way of Implementing?

1) Create one Image deploy the solution and EXpose multiple ports?

2) Use Docker COmpose and build proj1 Export port, build project 2 expose port 2 etc?

Any ideas much appreciated, please?

Upvotes: 0

Views: 868

Answers (1)

philipp
philipp

Reputation: 16485

I think the right solution depends on the requirements. Choosing option 1 would have those consequences:

  • one container with all services within, if it crashes, all services are down
  • scaling: each service will be scaled up, even if only one of them has to handle most of the traffic.
  • updates: changes in one service result in the »redeployment« of all the others within the container.
  • monitoring: Gathering metrics for each service can be gained based on the running containers, if all services run in one container you can monitor them all as one, or you need to implement you own way to separate logs.

In short: Since you can use a dedicated Image for each service, if you use docker-compose, you have a much finer granularity for updates, scaling and monitoring.

Upvotes: 1

Related Questions