version: '3.4' services: prometheus: image: prom/prometheus networks: - internal - external - prometheus-net - grafana-net volumes: - prometheus_config:/etc/prometheus - prometheus_data:/prometheus command: - "--config.file=/etc/prometheus/prometheus.yml" - "--storage.tsdb.path=/prometheus" - "--web.console.libraries=/usr/share/prometheus/console_libraries" - "--web.console.templates=/usr/share/prometheus/consoles" - "--storage.tsdb.retention.time=2y" - "--storage.tsdb.retention.size=5GB" deploy: mode: replicated replicas: 1 restart_policy: condition: on-failure delay: 5s volumes: prometheus_config: prometheus_data: networks: internal: internal: true external: prometheus-net: driver: overlay attachable: true internal: true grafana-net: external: true