Issues with dockerized eureka service ip - Docker communication

VERSION INFO
Client:
Version: 18.02.0-ce
API version: 1.35 (downgraded from 1.36)
Go version: go1.9.4
Git commit: fc4de447b5
Built: Mon Feb 12 19:03:38 2018
OS/Arch: windows/amd64
Experimental: false
Orchestrator: swarm

Server:
Engine:
Version: 17.12.1-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.9.4
Git commit: 7390fc6
Built: Tue Feb 27 22:20:43 2018
OS/Arch: linux/amd64
Experimental: false

I am using Docker Toolbox and the Oracle VM it comes with.

The dynamic registration of microservices works when I execute them outside a docker.
Eureka server is running fine on the VM. I can access it using 192.168.99.100:8761.
The microservicebelow does not register itself in the eureka service. Both container are able to run on the VM. I also can access each of them lonely through the browser on the VM and the microserviceis able to access the database that way. The issue is that the microservicedoes not register itself at the eureka service.

Somehow I think it’s an issue of the docker IP the eureka service is using on the VM and that’s why I am posting it here. Kind regards!

EUREKA-SERVICE

application.yml:

server:
  port: 8761

eureka:
  instance:
    prefer-ip-address: true
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://192.168.99.100:8761/

bootstrap.yml:

spring:
  application:
    name: eureka-service

MICROSERVICE (CLIENT)

application.properties

spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/shop
spring.datasource.username=shop
spring.datasource.password=shop
server.port=8080

application.yml

server:
  port: 8080
eureka:
  client:
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
      defaultZone: http://192.168.99.100:8761/
                     //IP of the VM:EUREKA PORT

docker-compose.yml

spring:
    jpa:
        database: MYSQL
        hibernate:
            ddl-auto: validate

    datasource:
        url: jdbc:mysql://mysql:3306/shop
        username: shop
        password: shop
        driver-class-name: com.mysql.jdbc.Driver

What am I doing to execute the microservice:

  • creating the jar
  • building an image of the created jar
    pull mysql using docker run --name microsql -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=shop -e MYSQL_USER=shop -e MYSQL_PASSWORD=shop -p 3306:3306 - d mysql:5.6
  • run the microservice image with sql using docker run -p 8080:8080 --name articlemicroservice --link microsql:mysql -d microservice/articlemicroservice