Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start Prometheus v2.0.0-alpha.3 in Docker container #2878

Closed
anirbanroydas opened this Issue Jun 26, 2017 · 9 comments

Comments

Projects
None yet
8 participants
@anirbanroydas
Copy link

anirbanroydas commented Jun 26, 2017

What did you do?
I started prometheus using docker by writing a docker-compose.yml file.

version: "3"

services:

  prometheus:
    image: prom/prometheus:v2.0.0-alpha.3
    ports:
      - "9090:9090"
    volumes:
      - ./prometheus/:/etc/prometheus/
      - ~/prometheus_data:/prometheus
    command:
      - '-config.file=/etc/prometheus/prometheus.yml'
      - '-storage.local.path=/prometheus'
      - '-storage.local.target-heap-size=524288000'
    restart: unless-stopped
    networks:
      - monitor-backend-dev
    labels:
      io.aroyd.service.name: "prometheus"
      io.aroyd.service.group: "monitoring"
      io.aroyd.service.title: "flitch"

networks:
  monitor-backend-dev:
    driver: bridge
  monitor-frontend-dev:
    driver: bridge

What did you expect to see?
A successful docker-compose up

What did you see instead? Under which circumstances?
Container restarting since restart condition was unless-stopped.

When I checked the logs, I saw the following:

sudo docker logs <container_id>
prometheus: error: unknown short flag '-c'
prometheus: error: unknown short flag '-c'
prometheus: error: unknown short flag '-c'
prometheus: error: unknown short flag '-c'
prometheus: error: unknown short flag '-c'
prometheus: error: unknown short flag '-c'
prometheus: error: unknown short flag '-c'
prometheus: error: unknown short flag '-c'

Environment

docker version info
Client:
 Version:      17.03.1-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Mon Mar 27 17:10:36 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.03.1-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Mon Mar 27 17:10:36 2017
 OS/Arch:      linux/amd64
 Experimental: false
  • System information:
Linux 3.13.0-119-generic x86_64
  • Prometheus version:

Used docker, so its mentioned in the docker-compose.yml pasted above.

  • Prometheus configuration file:
global:
  scrape_interval: 15s
  # evaluation_interval: 15s

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

# Load and evaluate rules in this file every 'evaluation_interval' seconds.
# rule_files:
#   - "targets.rules"
#   - "host.rules"
#   - "containers.rules"

scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 10s
    static_configs:
      - targets: ['localhost:9090']

  # - job_name: 'node-exporter'
  #   scrape_interval: 5s
  #   static_configs:
  #     - targets: ['node-exporter:9100']

  # - job_name: 'cadvisor'
  #   scrape_interval: 5s
  #   static_configs:
  #     - targets: ['cadvisor:8080']
  • Logs: Docker container logs
prometheus: error: unknown short flag '-c'
prometheus: error: unknown short flag '-c'
prometheus: error: unknown short flag '-c'
prometheus: error: unknown short flag '-c'
prometheus: error: unknown short flag '-c'
prometheus: error: unknown short flag '-c'
prometheus: error: unknown short flag '-c'
prometheus: error: unknown short flag '-c'

@anirbanroydas anirbanroydas changed the title Unable to start prometheus in docker container Unable to start Prometheus v2.0.0-alpha.3 in Docker container Jun 26, 2017

@gouthamve

This comment has been minimized.

Copy link
Member

gouthamve commented Jun 26, 2017

Hi the flag format change to -- instead of -. So you need to run with flags --config.file and so on.

For more changes see: https://prometheus.io/blog/2017/06/21/prometheus-20-alpha3-new-rule-format/

@anirbanroydas

This comment has been minimized.

Copy link
Author

anirbanroydas commented Jun 26, 2017

@gouthamve Thanks for such a quick response. Meanwhile I am using 1.7.1 just to get it going. What additional features do I get with v2.0.0-alpha.3 as compared to 1.7.1?

@AndreaGiardini

This comment has been minimized.

Copy link
Contributor

AndreaGiardini commented Jun 29, 2017

Just found this issue while encountering the same problem.

I think we can close this, leaving it as a reference

@matthiasr

This comment has been minimized.

Copy link
Contributor

matthiasr commented Jun 29, 2017

@anirbanroydas 2.0 rewrites major subsystems. there will be a proper announcement, or check the mailing list for the original alpha announcement. if in doubt, use a released version.

@matthiasr matthiasr closed this Jun 29, 2017

@alamaison

This comment has been minimized.

Copy link

alamaison commented Jul 13, 2017

Should this have been closed? It's a bug with the Dockerfile and released docker container

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Jul 13, 2017

You are right. Fix in #2942

@taragurung

This comment has been minimized.

Copy link

taragurung commented Jan 23, 2018

docker run -d -p 9100:9100 -v "/proc:/host/proc" -v "/sys:/host/sys" -v "/:/rootfs" --net="host" prom/node-exporter --collector.procfs /host/proc --collector.sysfs /host/proc --collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"

I am running these command and initially I have the error as mentioned above and than replaced single - with -- than I am getting the error bellow:
node_exporter: error: unknown long flag '--collector.procfs', try --help

@czerasz

This comment has been minimized.

Copy link

czerasz commented Apr 9, 2018

I also stumbled on this issue :-)

I see even though #2942 was merged in Jul 13, 2017 the Dockerfile on Docker HUB still shows:

FROM        quay.io/prometheus/busybox:latest
MAINTAINER  The Prometheus Authors <prometheus-developers@googlegroups.com>

COPY prometheus                             /bin/prometheus
COPY promtool                               /bin/promtool
COPY documentation/examples/prometheus.yml  /etc/prometheus/prometheus.yml
COPY console_libraries/                     /etc/prometheus/
COPY consoles/                              /etc/prometheus/

EXPOSE     9090
VOLUME     [ "/prometheus" ]
WORKDIR    /prometheus
ENTRYPOINT [ "/bin/prometheus" ]
CMD        [ "-config.file=/etc/prometheus/prometheus.yml", \
             "-storage.local.path=/prometheus", \
             "-web.console.libraries=/etc/prometheus/console_libraries", \
             "-web.console.templates=/etc/prometheus/consoles" ]

RazzDazz added a commit to RazzDazz/docker-prometheus that referenced this issue Dec 18, 2018

Changed CMD
prometheus/prometheus#2878
"-" changes to "--"
@lock

This comment has been minimized.

Copy link

lock bot commented Mar 22, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 22, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.