Skip to content

Use absolute paths in docker-compose.yml #48

Open

Description

@Xian55

Hello, good day!

Your Docker Compose file uses relative paths (e.g., ./config/...), which can be problematic when deploying through Portainer because the context directory might not be what you expect. Portainer might not have access to the same filesystem structure as your local development environment. Here are some steps and adjustments you can make to ensure it works properly:

General Adjustments

  1. Use Absolute Paths: When deploying with Portainer, it's better to use absolute paths for volumes to ensure the paths are correctly resolved.

  2. Verify Paths: Ensure all paths referenced in your docker-compose.yml actually exist on your host machine and are accessible.

  3. Permissions: Ensure the user running Portainer has the necessary permissions to access the files and directories specified.

One step to the right direction would be is to specify these /absolute/path/to/

version: '3'
name: netprobe

networks:
  netprobe-net:

services:
  redis:
    restart: always
    container_name: netprobe-redis
    image: "redis:latest"
    volumes:
      - /absolute/path/to/config/redis/redis.conf:/etc/redis/redis.conf
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4      

  netprobe:
    restart: always
    container_name: netprobe-probe
    image: "plaintextpackets/netprobe:latest"
    pull_policy: always
    volumes:
      - /absolute/path/to/netprobe_lite:/netprobe_lite
    environment:
      MODULE: "NETPROBE"
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4      

  speedtest:
    restart: always
    container_name: netprobe-speedtest
    image: "plaintextpackets/netprobe:latest"
    pull_policy: always
    volumes:
      - /absolute/path/to/netprobe_lite:/netprobe_lite
    environment:
      MODULE: "SPEEDTEST"
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4      

  presentation:
    restart: always
    container_name: netprobe-presentation
    image: "plaintextpackets/netprobe:latest"
    pull_policy: always
    volumes:
      - /absolute/path/to/netprobe_lite:/netprobe_lite
    environment:
      MODULE: "PRESENTATION"
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4      

  prometheus:
    restart: always
    container_name: netprobe-prometheus
    image: "prom/prometheus"
    volumes:
      - /absolute/path/to/config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
      - prometheus_data:/prometheus  # Persistent local storage for Prometheus data
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4      

  grafana:
    restart: always
    image: grafana/grafana-enterprise
    container_name: netprobe-grafana
    volumes:
      - /absolute/path/to/config/grafana/datasources/automatic.yml:/etc/grafana/provisioning/datasources/automatic.yml
      - /absolute/path/to/config/grafana/dashboards/main.yml:/etc/grafana/provisioning/dashboards/main.yml
      - /absolute/path/to/config/grafana/dashboards/netprobe.json:/var/lib/grafana/dashboards/netprobe.json
      - grafana_data:/var/lib/grafana
    ports:
      - '3001:3000'
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4      
      
volumes:
  prometheus_data:
  grafana_data:

Applying these changes should help resolve #29

If any of the config files are containing some path on your machine please also make it clear if it required to be specified.

example:

Activity

  1. Xian55 commented on May 20, 2024

    @Xian55
    Author

    I've opened a PR #49 how i managed to add support for Portrainer. Gooday!

  2. nipluvr commented on Aug 3, 2025

    @nipluvr

    Support for Portainer would be much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions