0

I'm using grafana and prometheus as containers and after running docker-compose up -d in cmd I am getting this error in cmd.

for ch4_grafana_1  Cannot start service grafana: Ports are not available: listen tcp 0.0.0.0:3000: bind: Only one usage of each socket address (protocol/network Creating ch4_prometheus_1 ... done                                                                                                                                      
ERROR: for grafana  Cannot start service grafana: Ports are not available: listen tcp 0.0.0.0:3000: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
ERROR: Encountered errors while bringing up the project.

docker-compose

version: '3'

services:
  grafana:
    image: "grafana/grafana:${GRAF_TAG-latest}"
    ports:
      - "3000:3000"
    volumes:
      - "${PWD-.}/grafana:/var/lib/grafana"

  prometheus:
    image: "prom/prometheus:${PROM_TAG-latest}"
    ports:
      - "9090:9090"
    volumes:
      - "${PWD-.}/prometheus:/etc/prometheus"

Any new Suggestions ? To Solve this...

MPin
  • 1
  • 2
  • Looks like port 3000 is taken already by something else. – Hans Kilian Jun 28 '21 at 10:34
  • Then what can i do next, Is it because i have already opened a grafana in other tab on my laptop ? – MPin Jun 28 '21 at 10:38
  • And my http://localhost:9090/targets (Prometheus is also not working) – MPin Jun 28 '21 at 10:41
  • You can only have one service listening on port 3000, so if you have another Grafana instance running already that is using port 3000, then you can't use port 3000 for your second instance. Please post your docker-compose file if you need more help. – Hans Kilian Jun 28 '21 at 10:45
  • Please tell me a ways to how to post docker-compose file here as it is not allowing me to paste here. – MPin Jun 28 '21 at 10:55
  • Edit your question and add the contents of your file to the question. – Hans Kilian Jun 28 '21 at 10:56
  • version: '3' services: grafana: image: "grafana/grafana:${GRAF_TAG-latest}" ports: - "3000:3000" volumes: - "${PWD-.}/grafana:/var/lib/grafana" prometheus: image: "prom/prometheus:${PROM_TAG-latest}" ports: - "9090:9090" volumes: - "${PWD-.}/prometheus:/etc/prometheus" – MPin Jun 28 '21 at 10:58
  • were u asking for this ? – MPin Jun 28 '21 at 10:59
  • 1
    Yes. But please edit your question and add it there rather than in a comment. – Hans Kilian Jun 28 '21 at 11:00
  • Yes, I have done that – MPin Jun 28 '21 at 11:03

0 Answers0