1
0

docker-compose.yml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. # Persists acme.sh state so certificate auto-renewal survives container
  22. # recreation (the entrypoint re-registers the renewal cron job from it).
  23. - $PWD/acme/:/root/.acme.sh/
  24. environment:
  25. XRAY_VMESS_AEAD_FORCED: "false"
  26. XUI_ENABLE_FAIL2BAN: "true"
  27. # Memory tuning. The panel keeps RAM low via GOGC + periodic release; it no
  28. # longer sets a soft limit from total host RAM (no benefit, risks GC thrash).
  29. # XUI_GOGC: "75" # lower = less RAM, slightly more CPU; GOGC env overrides
  30. # XUI_MEMORY_RELEASE_INTERVAL: "10" # minutes between FreeOSMemory; 0 disables
  31. # Go memory soft limit, only applied from an explicit budget below (or a
  32. # real cgroup/mem_limit cap). Pin it with one of:
  33. # XUI_MEMORY_LIMIT: "400" # in MiB
  34. # GOMEMLIMIT: "400MiB" # Go syntax, takes precedence
  35. # XUI_PPROF: "true" # expose pprof on 127.0.0.1:6060 for profiling
  36. # XUI_INIT_WEB_BASE_PATH: "/"
  37. # XUI_PORT: "8080"
  38. # To use PostgreSQL instead of the default SQLite, run:
  39. # docker compose --profile postgres up -d
  40. # and uncomment the two lines below.
  41. # XUI_DB_TYPE: "postgres"
  42. # XUI_DB_DSN: "postgres://xui:xui@postgres:5432/xui?sslmode=disable"
  43. tty: true
  44. ports:
  45. # When XUI_PORT is set, publish the same container port (for example "8080:8080").
  46. - "2053:2053"
  47. restart: unless-stopped
  48. postgres:
  49. image: postgres:16-alpine
  50. container_name: 3xui_postgres
  51. profiles: ["postgres"]
  52. environment:
  53. POSTGRES_USER: xui
  54. POSTGRES_PASSWORD: xui
  55. POSTGRES_DB: xui
  56. volumes:
  57. - $PWD/pgdata/:/var/lib/postgresql/data
  58. restart: unless-stopped