简体   繁体   中英

Cannot start service prometheus: oci runtime error: container_linux.go:235: starting container process caused "container init exited prematurely"

Where am I going wrong when running this compose?

I would just like to upload this container with compose using persistent volume

Compose:

version: '3.1'

services:
  prometheus:
    image: prom/prometheus
    container_name: meta_prometheus
    volumes:
      - ./config:/etc/prometheus/prometheus.yml 
      - ./data:/prometheus/data
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus/data'
    ports:
      - 9090:9090

Console:

[root@prometheus docker]# docker-compose up -d
Creating meta_prometheus ... error

ERROR: for meta_prometheus  Cannot start service prometheus: oci runtime error: container_linux.go:235: starting container process caused "container init exited prematurely"


ERROR: for prometheus  Cannot start service prometheus: oci runtime error: container_linux.go:235: starting container process caused "container init exited prematurely"

ERROR: Encountered errors while bringing up the project.

This part is wrong, as you're trying to mount a directory (./config) onto a file ... /etc/prometheus/prometheus.yml .. Which does not make sense..

volumes:
  - ./config:/etc/prometheus/prometheus.yml 

Maybe you wanted to write

volumes:
  - ./config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM