mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-14 00:26:06 +00:00
fix(docker): make x-ui CLI menu work inside containers
check_status() only recognized a systemd service or Alpine's /etc/init.d/x-ui, neither of which exists in a container where the panel runs as the foreground main process (PID 1 via "exec /app/x-ui"). Every CLI command therefore failed with "Please install the panel first", and restart/restart-xray relied on rc-service/systemctl that aren't present. Detect the container (/.dockerenv or XUI_IN_DOCKER) and, when inside one: - resolve the panel binary under /app instead of /usr/local/x-ui - derive status from the running process instead of a service file - restart via SIGHUP and restart-xray via SIGUSR1 to the panel process - show Docker-appropriate guidance for start/stop/enable/disable The Dockerfile sets XUI_IN_DOCKER/XUI_MAIN_FOLDER so detection is explicit even though /.dockerenv alone suffices. Closes #4817
This commit is contained in:
+2
-2
@@ -63,9 +63,9 @@ RUN chmod +x \
|
||||
/app/x-ui \
|
||||
/usr/bin/x-ui
|
||||
|
||||
ENV XUI_IN_DOCKER="true"
|
||||
ENV XUI_MAIN_FOLDER="/app"
|
||||
ENV XUI_ENABLE_FAIL2BAN="true"
|
||||
# Database backend: set XUI_DB_TYPE=postgres and XUI_DB_DSN=postgres://... to use PostgreSQL.
|
||||
# Default (unset) is SQLite stored under /etc/x-ui.
|
||||
ENV XUI_DB_TYPE=""
|
||||
ENV XUI_DB_DSN=""
|
||||
EXPOSE 2053
|
||||
|
||||
Reference in New Issue
Block a user