Host_volume mount of /var/lib/docker

Hello all. I try to volume_mount /var/lib/docker/containers folder with nomad job for the container that will run promtail. Every other location that i tried to mount till now was working correct. The nomad job instant fail and in the alloc/logs all of them are empty.
The idea is to use promtail to find all /var/lib/docker/containers//.logs and then tag them. Am i missing something and that location cannot be mounted?

Hi @dimitris.tzampanakis Thanks for using Nomad!

Nomad logs to the {data_dir}/allocs/{alloc_id} directory. That is likely what you want. Here’ some hopefully helpful links that will get you where you want to go.

  • Here is a great article that includes advice for promtail.
  • Here is a community pack that will install and run Loki for you.
  • This user has an interesting repo you might reference for inspiration. He even has a promtail specific job that might be exactly what you need.

Let us know if that helped!

1 Like

Thanks a lot. This repo that you send was exactly what i wanted. I make promtail with

consul_sd_configs:
- server: ‘172.17.0.1:8500’

and it read the logs from /allocs/alloc_id.

Glad that helped! And thanks for posting so others can benefit from your work.