Hello, this is my first post here and I’m sure I’m doing something wrong so feel free to call me out.
Anyways, I’m attempting to create a one-command creation of my Prometheus Stack which consists of:
- Blackbox Exporter
- A Web API I’ve created to interface with the above services
Each of these I currently have running in their own containers. I use the official latest images for the first three, and a custom docker image for the fourth (duh). The web api relies on the ability to interact with the configuration files for the other services and thus I’m attempting to set up a volume that would be shared between all four services.
I’m attempting to create a docker-compose file that builds the custom docker image for the api and pulls the images for the prometheus services. Additionally I try to create a volume that all four of them can access. Mind you, this is my first undertaking of a docker-compose project and I am also rather newbie at docker itself.
Here is my custom Dockerfile for the Web API
FROM private-repo.com/docker-java-python:1.0.12 #Install Git RUN apk add --update \ git # working directory WORKDIR /PrometheusWebAPI # copy current directory into the container ADD . /PrometheusWebAPI # install requirements RUN pip3 install --upgrade pip RUN pip3 install -r requirements.txt RUN pip3 install elastic-apm[flask] # clone prometheus configs and put them in the volume RUN git clone http://github.privaterepo.com/PrivateOrg/PrometheusConfiguration.git /prom_data/ # make port 8000 available to the world outside EXPOSE 5000 VOLUME ["prom_data"] CMD ["gunicorn", "--config", "./gunicorn_conf.py", "wsgi:app"]
As you can see… I’ve attempted to clone the required configurations and place them into the volume
Here is my docker-compose.yml:
version: '3.2' services: pwapi: build: . image: docker-pwapi:1.0.16 restart: always volumes: - type: volume source: prom_data target: /data volume: nocopy: true ports: - "5000:5000" depends_on: - prometheus - alertmanager - blackbox-exporter prometheus: image: private-repo.com/prometheus:latest container_name: docker-prometheus restart: always volumes: - type: volume source: prom_data target: /data volume: nocopy: true ports: - "9090:9090" alertmanager: image: private-repo.com/alertmanager:latest container_name: docker-alertmanager restart: always volumes: - type: volume source: prom_data target: /data volume: nocopy: true ports: - "9093:9093" blackbox-exporter: image: private-repo.com/blackbox-exporter:latest container_name: docker-blackbox-exporter restart: always volumes: - type: volume source: prom_data target: /data volume: nocopy: true ports: - "9115:9115" volumes: prom_data:
Can anyone guide me on the correct way to do this and maybe give me some pointers as to how I can achieve this? Thanks