From 50505ca283a55f0679e1a7afaa7e3474c4a5790e Mon Sep 17 00:00:00 2001 From: red Date: Tue, 8 Dec 2020 23:16:47 +0100 Subject: [PATCH 1/3] added self killing if healthcheck fails --- Dockerfile | 2 +- Dockerfile.aarch64 | 2 +- Dockerfile.armhf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index c0909a3ca03..870a49493f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN apk --no-cache --no-progress upgrade && \ COPY openvpn.sh /usr/bin/ HEALTHCHECK --interval=60s --timeout=15s --start-period=120s \ - CMD curl -LSs 'https://api.ipify.org' + CMD curl -LSs 'https://api.ipify.org' || kill 1 VOLUME ["/vpn"] diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 86baf45ca3d..e276ab35f8d 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -12,7 +12,7 @@ RUN apk --no-cache --no-progress upgrade && \ COPY openvpn.sh /usr/bin/ HEALTHCHECK --interval=60s --timeout=15s --start-period=120s \ - CMD curl -LSs 'https://api.ipify.org' + CMD curl -LSs 'https://api.ipify.org' || kill 1 VOLUME ["/vpn"] diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 3c7a3ddff03..69a4b94dfe6 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -12,7 +12,7 @@ RUN apk --no-cache --no-progress upgrade && \ COPY openvpn.sh /usr/bin/ HEALTHCHECK --interval=60s --timeout=15s --start-period=120s \ - CMD curl -LSs 'https://api.ipify.org' + CMD curl -LSs 'https://api.ipify.org' || kill 1 VOLUME ["/vpn"] From 47ad985e136c52617f25f5146ab5784baac5c2aa Mon Sep 17 00:00:00 2001 From: red Date: Sun, 20 Dec 2020 10:07:14 +0100 Subject: [PATCH 2/3] added autohealer --- Dockerfile | 2 +- Dockerfile.aarch64 | 2 +- Dockerfile.armhf | 2 +- docker-compose.yml | 8 ++++++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 870a49493f0..c0909a3ca03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN apk --no-cache --no-progress upgrade && \ COPY openvpn.sh /usr/bin/ HEALTHCHECK --interval=60s --timeout=15s --start-period=120s \ - CMD curl -LSs 'https://api.ipify.org' || kill 1 + CMD curl -LSs 'https://api.ipify.org' VOLUME ["/vpn"] diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index e276ab35f8d..86baf45ca3d 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -12,7 +12,7 @@ RUN apk --no-cache --no-progress upgrade && \ COPY openvpn.sh /usr/bin/ HEALTHCHECK --interval=60s --timeout=15s --start-period=120s \ - CMD curl -LSs 'https://api.ipify.org' || kill 1 + CMD curl -LSs 'https://api.ipify.org' VOLUME ["/vpn"] diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 69a4b94dfe6..3c7a3ddff03 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -12,7 +12,7 @@ RUN apk --no-cache --no-progress upgrade && \ COPY openvpn.sh /usr/bin/ HEALTHCHECK --interval=60s --timeout=15s --start-period=120s \ - CMD curl -LSs 'https://api.ipify.org' || kill 1 + CMD curl -LSs 'https://api.ipify.org' VOLUME ["/vpn"] diff --git a/docker-compose.yml b/docker-compose.yml index a19d8082661..aff449a0100 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,6 +27,14 @@ services: # - ./vpn:/vpn # command: 'server;user;password[;port]' + autoheal: + image: willfarrell/autoheal + volumes: + - /var/run/docker.sock:/var/run/docker.sock + restart: unless-stopped + environment: + AUTOHEAL_CONTAINER_LABEL: all + # Replace "service1" with and image with an actual service you want to run service1: image: docker_hub_user/container_name From 15944951ad0de217b17dd4d73f3b0041292e8aa0 Mon Sep 17 00:00:00 2001 From: Aleksandr Bochev Date: Sun, 7 Feb 2021 14:52:01 +0100 Subject: [PATCH 3/3] autoheal required images --- docker-compose.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index aff449a0100..304218b9d22 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,8 @@ services: - net_admin environment: TZ: 'EST5EDT' + labels: + autoheal: true networks: - default # if using '-d' or 'DNS' you can't enable the `read_only: true` option @@ -32,8 +34,6 @@ services: volumes: - /var/run/docker.sock:/var/run/docker.sock restart: unless-stopped - environment: - AUTOHEAL_CONTAINER_LABEL: all # Replace "service1" with and image with an actual service you want to run service1: @@ -42,6 +42,8 @@ services: - vpn environment: TZ: 'EST5EDT' + labels: + autoheal: true network_mode: "service:vpn" restart: unless-stopped stdin_open: true