29 lines
532 B
Markdown
29 lines
532 B
Markdown
|
---
|
||
|
tags: [docker, procedural]
|
||
|
created: Thursday, April 24, 2025
|
||
|
---
|
||
|
|
||
|
# Viewing Docker logs
|
||
|
|
||
|
## View logs from outside of container
|
||
|
|
||
|
```sh
|
||
|
docker logs <container_name> OR <container_id>
|
||
|
```
|
||
|
|
||
|
To view the logs in realtime, apend `-f` for `--follow`:
|
||
|
|
||
|
```sh
|
||
|
docker logs -f <container_name> OR <container_id>
|
||
|
```
|
||
|
|
||
|
## View logs from within the container
|
||
|
|
||
|
For example, to view nginx logs, first
|
||
|
[enter into the container](./Enter_into_a_Docker_container.md) and then:
|
||
|
|
||
|
```sh
|
||
|
cat /var/log/nginx/access.log
|
||
|
cat /var/log/nginx/error.log
|
||
|
```
|