qdm12 / deunhealth

Binary program to restart unhealthy Docker containers
MIT License
124 stars 8 forks source link

Feature request: Support for docker socket proxy #3

Closed jathek closed 3 years ago

jathek commented 3 years ago

What's the feature? 🧐

Support for docker socket proxy

With images that support the socket proxy, I can set DOCKER_HOST: tcp://socket-proxy:2375 as an env and then everything works fine.

qdm12 commented 3 years ago

This should be added in d59bfb5b1b95a6c733ad4bbeaa49b1c72fff9e90

Can you try with the latest image qmcgaw/deunhealth please? I haven't tested it 😉

docker pull qmcgaw/deunhealth
jathek commented 3 years ago
  deunhealth:
    image: qmcgaw/deunhealth:latest
    container_name: deunhealth
    restart: unless-stopped
    networks:
      socket_proxy:
    depends_on:
      - socket-proxy
    environment:
      TZ: "$TZ"
      LOG_LEVEL: debug # default: info (debug, info, warning, error)
      DOCKER_HOST: tcp://socket-proxy:2375

Seems to work fine with this docker compose, although the log doesn't show anything, even with debug. Maybe there should be a message in debug (or even info) saying where the docker host is found? In the meanwhile I guess I'll just wait until a container goes unhealthy and see if deunhealth fixes it.

EDIT: deunhealth restarted a container, so seems to work

2021-09-07 17:30:46.27242681 CDT ========================================
2021-09-07 17:30:46.27246625 CDT ========================================
2021-09-07 17:30:46.27247818 CDT ============== deunhealth ==============
2021-09-07 17:30:46.27248405 CDT ========================================
2021-09-07 17:30:46.27248940 CDT =========== Made with ❤️by ============
2021-09-07 17:30:46.27249517 CDT =========== github.com/qdm12 ===========
2021-09-07 17:30:46.27250079 CDT ========================================
2021-09-07 17:30:46.27250631 CDT ========================================
2021-09-07 17:30:46.27251179 CDT
2021-09-07 17:30:46.27251752 CDT Running version latest built on 2021-09-07T19:37:18Z (commit 6ee57e4)
2021-09-07 17:30:46.27252504 CDT
2021-09-07 17:30:46.27253076 CDT 🔧 Need help? https://github.com/qdm12/deunhealth/discussions/new
2021-09-07 17:30:46.27253668 CDT 🐛 Bug? https://github.com/qdm12/deunhealth/issues/new
2021-09-07 17:30:46.27254220 CDT ✨ New feature? https://github.com/qdm12/deunhealth/issues/new
2021-09-07 17:30:46.27254773 CDT ☕ Discussion? https://github.com/qdm12/deunhealth/discussions/new
2021-09-07 17:30:46.27255313 CDT 💻 Email? quentin.mcgaw@gmail.com
2021-09-07 17:30:46.27255876 CDT 💰 Help me? https://www.paypal.me/qmcgaw https://github.com/sponsors/qdm12
2021-09-07 17:30:46.27256732 CDT 2021/09/07 17:30:46 INFO healthcheck: listening on 127.0.0.1:9999
2021-09-07 18:02:49.88373405 CDT 2021/09/07 18:02:49 INFO container organizr (image organizr/organizr) is unhealthy, restarting it...
2021-09-07 18:02:53.65439870 CDT 2021/09/07 18:02:53 INFO container organizr restarted successfully
qdm12 commented 3 years ago

Thanks for the feedback! And yes, sorry I've been lazy on the logging out of settings etc.

I'll most likely make it more polished for a v1.0.0 release.

Next step is to restart gluetun connected containers properly once gluetun gets updated & restarted!

qdm12 commented 3 years ago

196b83433544d66914cb4294c38ca628bfafc76b introduces a logged line to show the number of containers monitored