'How to build a Loki server Docker image using Docker-compose
I have created a directory and mounted all the required files in each directory but when I try to create the docker image, It creates Promtail and Grafana but the LOKI wouldn't create. I get the error message below;
ERROR: for 9c35c983e8e4_cbxs_loki_1 Cannot start service loki: Mounts denied: You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
I have mounted the files just as the order containers.. Please help
docker-compose.yml
Please see the file on the link below https://docs.technotim.live/posts/grafana-loki/
version: "3"
networks:
loki:
services:
loki:
image: grafana/loki:2.4.0
ports:
- "3100:3100"
restart: unless-stopped
command: -config.file=/etc/loki/loki-config.yml
networks:
- loki
promtail:
image: grafana/promtail:2.4.0
volumes:
- /var/log:/var/log
- /Users/emma.egbu/CBCS/Promtail:/etc/promtail
ports:
- "1514:1514"
restart: unless-stopped
command: -config.file=/etc/promtail/promtail-config.yml
networks:
- loki
grafana:
image: grafana/grafana:latest
user: "1000"
volumes:
- /Users/emma.egbu/CBCS/Grafana:/var/lib/grafana
ports:
- "3000:3000"
restart: unless-stopped
networks:
- loki
Thank you so much ! That was helpful...
For anyone going through the same struggle, here was what I did:
I went to edit the docker daemon config file
sudo nano /etc/docker/daemon.json - Probably you won't have write access so
sudo vi chmod 666 /etc/docker/daemon.json - This will allow u write
I pasted the file below
{
"log-driver": "loki",
"log-opts": {
"loki-url": "http://localhost:3100/loki/api/v1/push",
"loki-batch-size": "400"
}
Afterwards I restarted my docker then also
docker-compose up -d --force-recreate - to run up the docker-compose file
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
