Docker version: Docker version 17.06.0-ce, build 02c1d8
Compose version: docker-compose version 1.14.0, build c7bdf9e
So I have the following docker-compose file to run NGINX:
version: "3.0"
services:
nginx:
ports:
- 80:80
volumes:
- ./prod/nginx.conf:/etc/nginx/nginx.conf:ro
- nginx_logs:/var/log/nginx:rw
- /data/thumbs:/thumbs:ro
volumes:
nginx_logs:
external: true
I created the nginx_logs
volume by running docker volume create --name=nginx_logs
Now, I tried to access the logs from an other container (filebeat here) running:
docker run \
--name filebeat \
-v nginx_logs:/var/log \
-it filebeat /bin/bash
However when running ls -l /var/log
in the filebeat
docker I clearly see 2 log files, but with a symlink attached to it:
/var/log/access.log -> /dev/stdout
/var/log/error.log -> /dev/stdout
Why is a symlink created ?
If I remove the file and run touch /var/log/access.log
, I can read the file but not with the symlink.
Any idea how to avoid having to run the touch
command ?