1. version: "3.8"
  2. 
  3. services:
  4. mongodb:
  5. image: mongo:7
  6. networks:
  7. - app_network
  8. volumes:
  9. - mongodb_data:/data/db
  10. - mongodb_configdb_data:/data/configdb
  11. environment:
  12. MONGO_INITDB_ROOT_USERNAME: <USUARIO_AQUI>
  13. MONGO_INITDB_ROOT_PASSWORD: <SUA_SENHA_AQUI>
  14. PUID: 1000
  15. PGID: 1000
  16. deploy:
  17. mode: replicated
  18. replicas: 1
  19. placement:
  20. constraints:
  21. - node.role == manager
  22. resources:
  23. limits:
  24. cpus: "0.5"
  25. memory: 512M
  26. 
  27. volumes:
  28. mongodb_data:
  29. external: true
  30. mongodb_configdb_data:
  31. external: true
  32. 
  33. networks:
  34. app_network:
  35. external: true