mardi 9 juillet 2019

Random ports inside docker-compose with spring cloud config

I develop some microservices with spring cloud config (external config place). For service discovery i use Eureka.

I set property for my user-service (usual microservice) in application.yml

  port: ${PORT:0}

It means that service will use random ,not busy port. I need possibility to make request for it from my local machine (localhost) , so i need to open ports to it.

    container_name: user-service
    environment:
      - SPRING_CLOUD_CONFIG_URI=http://config-service:8888
      - SPRING_PROFILES_ACTIVE=docker
    image: senla/userservice
    ports:
      - "8000:8000"
    networks:
      - blog

at eureka i see that user-service registered like this: http://ae7b0d5a1ef6:44259/actuator/info

i wonder what should i set at

ports:
  - "8000:{here}"

?




Aucun commentaire:

Enregistrer un commentaire