EasyEngine / docker-compose-wordpress

Work in progress! 👷
https://easyengine.io/blog/how-we-plan-to-use-docker-in-easyengine-v4/
MIT License
29 stars 14 forks source link

Log files #8

Open rahul286 opened 6 years ago

rahul286 commented 6 years ago
vishaldodiya commented 6 years ago

Can we access log files as it is? From host location?

One can map log files from docker container to host files. for example,

  nginx:
    image: nginx:latest
    depends_on:
      - php
    restart: always
    ports:
      - "80:80"
    volumes:
      - "./wordpress:/var/www/html"
      - "./config/nginx/default.conf:/etc/nginx/conf.d/default.conf"
      - "./config/nginx/log/error.log:/var/log/nginx/error.log"
      - "./config/nginx/log/access.log:/var/log/nginx/access.log"

Does docker logs exposes some magic?

In docker logs command one can get log from specific container using container name or container id, like

$ docker logs -f <container_id>/<container_name>

Reference https://docs.docker.com/engine/reference/commandline/logs/


Also one can use docker-compose log to get logs from all services. Reference https://docs.docker.com/compose/reference/logs/

rahul286 commented 6 years ago

@vishaldodiya Thanks for adding details.

If you like to send a PR, that would be great! :)

mbtamuli commented 6 years ago

In addition to what @vishaldodiya said, for docker-compose, we can see the logs from all containers using

docker-compose logs -f

with the -f flag for tail ing the logs.

This is already added in the README.