Doubts concerning microservices and containers

0

Good afternoon, We are starting to develop new applications with microservices, contenders ... and we are finding a series of doubts about them that, even though we are looking for, we can not solve them 100%, the question is the following: We have developed several microservices and when entering them in the container we execute the following statement for each microservice that we created:

  

docker run -d -p 8080: 8080 --name micro1 micro-service-spring-boot: 0.0.1-SNAPSHOT

so if we have several microservices: micro1, micro2, ... microN we execute this previous statement as many times as we have microservices (so we have to change the port). The thing is that if all the microservices are deployed inside the container each one will have a different port. Is it possible that the microservices will be deployed in the same container and all have the same port and will only change the access route to it?

    
asked by Alberto 27.12.2017 в 15:11
source

1 answer

1

I do not advise doing the deployment in this way, it is best to deploy the microservices using Docker Swarm. Follow the steps below:

  • Create a Dockerfile file for each of the microservices.

  • Create a yml file for the deployment of all microservices using docker-compose .

  • Create a bash script for building the images using docker build , swarm start with docker init swarm , and deploying the solution with the yml file using the docker stack deploy command and its respective options.

  • answered by 27.12.2018 в 22:39