Context Deadline Exceeded - Docker

1,763 views
Skip to first unread message

rohan khanna

unread,
Jun 8, 2017, 10:49:34 AM6/8/17
to Prometheus Users
Hi,

I just started exploring Prometheus and would be glad if someone could help me with thr issue I am facing right now.
I am trying the docker image. 
This is my docker-compose file.


prometheus:
   image: prom/prometheus
   container_name: prom        
   expose:
     - 9090
   ports: 
     - "9090:9090" 
   volumes:  
     - ~/prometheus.yml:/etc/prometheus/prometheus.yml
     - /home/eit/prometheus:/etc/prometheus
   command:
     - '-config.file=/etc/prometheus/prometheus.yml'
   restart: always 


This is my prometheus.yml file:

global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
    monitor: 'codelab-monitor'

# A scrape configuration scraping a Node Exporter and the Prometheus server
# # itself.
scrape_configs:
  - job_name:       'example-random'

  # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s
             
    static_configs:
      - targets: ['localhost:8080', 'localhost:8081']
        labels:
          group: 'production'
                
      - targets: ['localhost:8082']
        labels:
          group: 'canary'

Now, I am trying the Getting Started tutorial described here. https://prometheus.io/docs/introduction/getting_started/

I am able to get results ebfore the "Starting up some sample targets" but after that when I configure everything as per the wiki, I am not getting results and from the UI I get the "Context Deadline Error".
Please tell me where I am going wrong.

Regards
RK

rohan khanna

unread,
Jun 8, 2017, 10:57:25 AM6/8/17
to Prometheus Users
Apologies, the "Context Deadline Exceeded" error was when I was putting the IP of the host which is running docker. Now when I put localhost, I get the following error.

rohan khanna

unread,
Jun 12, 2017, 9:55:26 AM6/12/17
to Prometheus Users
Solved: Need to access the host ports.
network_mode: "host" in the compose file solved the issue.

P.S - You need to specify the version number and use proper yml syntax.

On Thursday, June 8, 2017 at 4:49:34 PM UTC+2, rohan khanna wrote:

khushb...@motorolasolutions.com

unread,
Jun 22, 2018, 2:45:32 PM6/22/18
to Prometheus Users
Hi Rohan

I'm facing a similar issue. Could you please post your docker-compose file?
Reply all
Reply to author
Forward
0 new messages