1
0

docker-compose.yml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. services:
  2. 3xui:
  3. build:
  4. context: .
  5. dockerfile: ./Dockerfile
  6. container_name: 3xui_app
  7. # hostname: yourhostname <- optional
  8. # Optional hard memory cap. When set, the panel derives its Go soft limit
  9. # (GOMEMLIMIT, ~90% of this cap) so it GCs before the OOM killer fires.
  10. # mem_limit: 512m
  11. # The bundled Fail2ban (XUI_ENABLE_FAIL2BAN below) enforces the IP limit
  12. # with iptables, which needs NET_ADMIN. Without these caps a ban is logged
  13. # and shown in fail2ban status but never actually applied. NET_RAW covers
  14. # ip6tables. If you disable Fail2ban, you can drop cap_add.
  15. cap_add:
  16. - NET_ADMIN
  17. - NET_RAW
  18. volumes:
  19. - $PWD/db/:/etc/x-ui/
  20. - $PWD/cert/:/root/cert/
  21. environment:
  22. XRAY_VMESS_AEAD_FORCED: "false"
  23. XUI_ENABLE_FAIL2BAN: "true"
  24. # Memory tuning. The panel keeps RAM low via GOGC + periodic release; it no
  25. # longer sets a soft limit from total host RAM (no benefit, risks GC thrash).
  26. # XUI_GOGC: "75" # lower = less RAM, slightly more CPU; GOGC env overrides
  27. # XUI_MEMORY_RELEASE_INTERVAL: "10" # minutes between FreeOSMemory; 0 disables
  28. # Go memory soft limit, only applied from an explicit budget below (or a
  29. # real cgroup/mem_limit cap). Pin it with one of:
  30. # XUI_MEMORY_LIMIT: "400" # in MiB
  31. # GOMEMLIMIT: "400MiB" # Go syntax, takes precedence
  32. # XUI_PPROF: "true" # expose pprof on 127.0.0.1:6060 for profiling
  33. # XUI_INIT_WEB_BASE_PATH: "/"
  34. # XUI_PORT: "8080"
  35. # To use PostgreSQL instead of the default SQLite, run:
  36. # docker compose --profile postgres up -d
  37. # and uncomment the two lines below.
  38. # XUI_DB_TYPE: "postgres"
  39. # XUI_DB_DSN: "postgres://xui:xui@postgres:5432/xui?sslmode=disable"
  40. tty: true
  41. ports:
  42. # When XUI_PORT is set, publish the same container port (for example "8080:8080").
  43. - "2053:2053"
  44. restart: unless-stopped
  45. postgres:
  46. image: postgres:16-alpine
  47. container_name: 3xui_postgres
  48. profiles: ["postgres"]
  49. environment:
  50. POSTGRES_USER: xui
  51. POSTGRES_PASSWORD: xui
  52. POSTGRES_DB: xui
  53. volumes:
  54. - $PWD/pgdata/:/var/lib/postgresql/data
  55. restart: unless-stopped