#/opt/ping_exporter# cat docker-compose.yml
version: '3'
services:
  ping_exporter:
    image: czerwonk/ping_exporter:latest #image
    container_name: ping_exporter
    restart: unless-stopped
    ports:
      - "9427:9427"  #port:port
    volumes:
      - ./:/config/ # 将宿主机的/opt/ping_exporter目录挂载到容器的./config
#   command: [ "sh", "-c", "./ping_exporter --config.path /config/config.yml --metrics.deprecated=enable" ]
    command:
      - sh
      - -c
      - ./ping_exporter --config.path /config/config.yml --metrics.deprecated=enable

