Both of the previous answers are correct, but I will make copying easier.
What you have to do is add an environment variable with the host IP address when starting your container, and include it in your Spring Boot application.yml file.
application.yml
eureka: instance: # Necessary for Docker as it does not have DNS entries prefer-ip-address: true # Necessary for Docker otherwise you will get 172.0.0.x IP ip-address: "${HOST}" client: serviceUrl: # Location of your eureka server defaultZone: http:
Running with Docker
docker run -p <port>:<port> -e HOST='192.168.0.106' <image name>
Running with docker-compose
my_service: image: image_name environment: - HOST=192.168.0.106 ports: - your_port:container_port
source share