From 4dc7175588c30ad052b48feaac69206da81b02c5 Mon Sep 17 00:00:00 2001 From: Tim Dreyer <74516735+eyerrock@users.noreply.github.com> Date: Thu, 24 Apr 2025 22:32:58 +0200 Subject: [PATCH] refactor: docker container list --- docker/Dockerfile | 2 + docker/README.md | 8 + docker/docker-compose.yml | 2 + src/web/snippet/dockerContainersList.html | 359 +++++++++++++++++----- 4 files changed, 294 insertions(+), 77 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 2375adb..9260d20 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -72,6 +72,8 @@ ENV WEBROOT="./www" VOLUME [ "/opt/zoraxy/config/" ] +LABEL com.imuslab.zoraxy.container-identifier="Zoraxy" + ENTRYPOINT [ "/opt/zoraxy/entrypoint.sh" ] HEALTHCHECK --interval=15s --timeout=5s --start-period=10s --retries=3 CMD nc -vz 127.0.0.1 $PORT || exit 1 diff --git a/docker/README.md b/docker/README.md index 74126a8..38629cd 100644 --- a/docker/README.md +++ b/docker/README.md @@ -19,6 +19,7 @@ Once setup, access the webui at `http://:8000` to configure Zoraxy. Cha docker run -d \ --name zoraxy \ --restart unless-stopped \ + --add-host=host.docker.internal:host-gateway \ -p 80:80 \ -p 443:443 \ -p 8000:8000 \ @@ -47,6 +48,8 @@ services: - /path/to/zoraxy/plugin/:/opt/zoraxy/plugin/ - /var/run/docker.sock:/var/run/docker.sock - /etc/localtime:/etc/localtime + extra_hosts: + - "host.docker.internal:host-gateway" environment: FASTGEOIP: "true" ``` @@ -68,6 +71,11 @@ services: | `/var/run/docker.sock` | Docker socket. Used for additional functionality with Zoraxy. | | `/etc/localtime` | Localtime. Set to ensure the host and container are synchronized. | +### Extra Hosts +| Host | Details | +|:-|:-| +| `host.docker.internal:host-gateway` | Resolves host.docker.internal to the host’s gateway IP on the Docker bridge network, allowing containers to access services running on the host machine. | + ### Environment Variables are the same as those in [Start Parameters](https://github.com/tobychui/zoraxy?tab=readme-ov-file#start-paramters). diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index ce348c8..f32b973 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -12,5 +12,7 @@ services: - /path/to/zoraxy/plugin/:/opt/zoraxy/plugin/ - /var/run/docker.sock:/var/run/docker.sock - /etc/localtime:/etc/localtime + extra_hosts: + - "host.docker.internal:host-gateway" environment: FASTGEOIP: "true" diff --git a/src/web/snippet/dockerContainersList.html b/src/web/snippet/dockerContainersList.html index c79a8c8..2eca23a 100644 --- a/src/web/snippet/dockerContainersList.html +++ b/src/web/snippet/dockerContainersList.html @@ -1,14 +1,14 @@ - + - +
@@ -26,35 +26,54 @@
+
- List of Docker Containers + Networked Containers
- Below is a list of all detected Docker containers currently running - on the system. + Containers sharing a network with Zoraxy.
+ Docker DNS based name resolution has to be supported by your + network.
-
-
+
+
+ + +
-