docker-compose.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. services:
  2. 3xui:
  3. build:
  4. context: .
  5. dockerfile: ./Dockerfile
  6. container_name: 3xui_app
  7. # hostname: yourhostname <- optional
  8. # The bundled Fail2ban (XUI_ENABLE_FAIL2BAN below) enforces the IP limit
  9. # with iptables, which needs NET_ADMIN. Without these caps a ban is logged
  10. # and shown in fail2ban status but never actually applied. NET_RAW covers
  11. # ip6tables. If you disable Fail2ban, you can drop cap_add.
  12. cap_add:
  13. - NET_ADMIN
  14. - NET_RAW
  15. volumes:
  16. - $PWD/db/:/etc/x-ui/
  17. - $PWD/cert/:/root/cert/
  18. environment:
  19. XRAY_VMESS_AEAD_FORCED: "false"
  20. XUI_ENABLE_FAIL2BAN: "true"
  21. # To use PostgreSQL instead of the default SQLite, run:
  22. # docker compose --profile postgres up -d
  23. # and uncomment the two lines below.
  24. # XUI_DB_TYPE: "postgres"
  25. # XUI_DB_DSN: "postgres://xui:xui@postgres:5432/xui?sslmode=disable"
  26. tty: true
  27. ports:
  28. - "2053:2053"
  29. restart: unless-stopped
  30. postgres:
  31. image: postgres:16-alpine
  32. container_name: 3xui_postgres
  33. profiles: ["postgres"]
  34. environment:
  35. POSTGRES_USER: xui
  36. POSTGRES_PASSWORD: xui
  37. POSTGRES_DB: xui
  38. volumes:
  39. - $PWD/pgdata/:/var/lib/postgresql/data
  40. restart: unless-stopped