sameersbn / docker-apt-cacher-ng

Dockerfile to create a Docker container image for Apt-Cacher NG
MIT License
206 stars 71 forks source link

Health check is failing because of invalid wget options #23

Closed jamshid closed 4 years ago

jamshid commented 5 years ago

The health check needs to be updated. docker-compose ps always reports it's unhealthy:

buildenv_aptcacherng_1   /sbin/entrypoint.sh /usr/s ...   Up (unhealthy)   0.0.0.0:3142->3142/tcp          

because -0 is no longer supported by wget and there is a stray - argument being passed. The container is otherwise working fine. You can verify by exec'ing into the container.

root@d06e973fc467:/# wget -q0 - http://localhost:3142/acng-report.html
wget: invalid option -- '0'
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.

Just change the Dockerfile to (updated to not write an .html file ever 2s!):

HEALTHCHECK --interval=90s --timeout=5s --retries=3 \
    CMD wget -q -o /dev/null http://localhost:3142/acng-report.html || exit 1

Users of docker-compose.yml can do this themselves with:

version: '3.7'

volumes:
  aptcache:

x-common: &common
  restart: always
  init: true

services:

  aptcacherng:
    image: sameersbn/apt-cacher-ng
    <<: *common
    deploy:
      resources:
        limits:
          memory: ${CACHER_MEM-256m}
    volumes:
      - aptcache:/var/cache/apt-cacher-ng
    ports:
      - "${PUBLISH_IP}3142:3142"
    healthcheck:
      test:  wget -q  http://localhost:3142/acng-report.html || exit 1
      interval: 10s
      timeout: 2s
      retries: 3
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

eddyg commented 4 years ago

This issue should be re-opened...

sameersbn commented 4 years ago

was fixed in #25