Skip to content
This repository has been archived by the owner on Aug 10, 2020. It is now read-only.

Log files #8

Open
2 tasks
rahul286 opened this issue Dec 7, 2017 · 3 comments
Open
2 tasks

Log files #8

rahul286 opened this issue Dec 7, 2017 · 3 comments

Comments

@rahul286
Copy link
Member

rahul286 commented Dec 7, 2017

  • Can we access log files as it is? From host location?
  • Does docker logs exposes some magic?
@vishaldodiya
Copy link

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
Copy link
Member Author

@vishaldodiya Thanks for adding details.

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

@mbtamuli
Copy link
Contributor

mbtamuli commented Dec 29, 2017

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants