Create container-execution.md

pull/1/head
Josh Stark 2019-01-24 20:55:54 +00:00 zatwierdzone przez GitHub
rodzic 2b5b1dfc6e
commit 2fbbd392c7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 46 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,46 @@
# Container Execution
You may find at some point you need to view the internal data of a container.
## Shell Access
Particularly useful when debugging the application - to shell in to one of our containers, run the following:
```bash
docker exec -it <container_name> /bin/bash
```
## Tailing the logs
The vast majority of our images are configured to output the application logs to the console, which in Docker's terms means you can access them using the `docker logs` command:
```bash
docker logs -f --tail=<number_of_lines_to_start_with> <container_name>
```
The `--tail` argument is optional, but useful if the application has been running for a long time - the `logs` command by default will output _all_ logs.
To make life simpler for yourself here's a handy bash alias to do some of the leg work for you:
```bash
# ~/.bash_aliases
alias dtail='docker logs -tf --tail="50" "$@"'
```
Execute it with `dtail <container_name>`.
## Checking the build version
If you are experiencing issues with one of our containers, it helps us to know which version of the image your container is running from. The primary reason we ask for this is because you may be reporting an issue we are aware of and have subsequently fixed. However, if you are running on the latest version of our image, it could indeed be a newly found bug, which we'd want to know more about.
To obtain the build version for the image:
```bash
docker inspect -f '{{ index .Config.Labels "build_version" }}' <container_name>
```
Or the container:
```bash
docker inspect -f '{{ index .Config.Labels "build_version" }}' linuxserver/<image_name>
```