mock-server / mockserver

MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).
http://mock-server.com
Apache License 2.0
4.62k stars 1.08k forks source link

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

Open aokhonchenko opened 3 months ago

aokhonchenko commented 3 months ago

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.

kasir-barati commented 2 months ago

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.