mockserver icon indicating copy to clipboard operation
mockserver copied to clipboard

[Bug] No way to implement docker-compose health-check

Open aokhonchenko opened this issue 1 year ago • 1 comments

I am trying to do simple thing - check readiness probe with docker-compose.

tag - 5.15.0


  mockserver:
    image: mockserver/mockserver:5.15.0
    ports:
      - "17777:1080"
    environment:
      MOCKSERVER_PORT_NUMBER: 1080
      MOCKSERVER_LIVENESS_HTTP_GET_PATH: "/liveness/probe"
      MOCKSERVER_INITIALIZATION_JSON_PATH: "/stubs/*.json"
      MOCKSERVER_WATCH_INITIALIZATION_JSON: true
      MOCKSERVER_LOG_LEVEL: DEBUG
    healthcheck:
#      test: curl --fail http://localhost:1080/liveness/probe || exit 1
      test: wget --no-verbose --tries=1 --spider http://localhost:1080/liveness/probe || exit 1
      interval: 60s
      retries: 5
      start_period: 5s
      timeout: 10s
    volumes:
      - type: bind
        source: ./src/test/resources/stubs
        target: /stubs
        read_only: true

After about 60s server fails.

aokhonchenko avatar Aug 06 '24 09:08 aokhonchenko

Any update? or if it is not possible please let us know by adding a section in docker hub so people know that it does not have something like that.

I also tried to exec inside it and check what is available but it seems this image has a very fundamental issue. $PATH is unknown. In other word curl, wget or any kind of command in general cannot be used. Try to exec into it like this:

docker exec -it container_id /bin/sh
# or
docker exec -it container_id /bin/bash
# or
docker exec -it container_id bash

So I guess the problem lies in $PATH.

kasir-barati avatar Aug 29 '24 20:08 kasir-barati