informatica:linux:docker
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
informatica:linux:docker [2019/10/11 08:33] – javi | informatica:linux:docker [2021/01/11 06:15] – [Estadísticas] javi | ||
---|---|---|---|
Line 35: | Line 35: | ||
sudo service docker restart | sudo service docker restart | ||
+ | |||
+ | ===== Habilitar debug ===== | ||
+ | |||
+ | https:// | ||
+ | |||
+ | 1. Editar: | ||
+ | |||
+ | sudo vim / | ||
+ | |||
+ | Y añadir: | ||
+ | |||
+ | < | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | 2. Recargar el servicio: | ||
+ | |||
+ | sudo kill -SIGHUP $(pidof dockerd) | ||
+ | | ||
+ | 3. Ver logs | ||
+ | |||
+ | sudo tail -F / | ||
+ | | ||
+ | |||
+ | |||
====== Ejecutar como no root ====== | ====== Ejecutar como no root ====== | ||
Line 121: | Line 148: | ||
====== Cambiar politica de reinicio de contenedor ====== | ====== Cambiar politica de reinicio de contenedor ====== | ||
+ | https:// | ||
+ | |||
+ | Miramos que política tiene: | ||
+ | docker inspect container_name| jq -r ' | ||
+ | < | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ^Flag^Description^ | ||
+ | |no|Do not automatically restart the container. (the default)| | ||
+ | |on-failure|Restart the container if it exits due to an error, which manifests as a non-zero exit code.| | ||
+ | |always|Always restart the container if it stops. If it is manually stopped, it is restarted only when Docker daemon restarts or the container itself is manually restarted. (See the second bullet listed in restart policy details)| | ||
+ | |unless-stopped|Similar to always, except that when the container is stopped (manually or otherwise), it is not restarted even after Docker daemon restarts.| | ||
+ | |||
- | Con el contenedor corriendo: | + | Para cambiarlo |
docker update --restart unless-stopped container_name | docker update --restart unless-stopped container_name | ||
Line 1040: | Line 1084: | ||
Para mostrar estadísticas de consumo de recursos por contenedor: | Para mostrar estadísticas de consumo de recursos por contenedor: | ||
- | docker stats --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemPerc}}\t{{.MemUsage}}" | + | |
====== Usar variables de entorno en tiempo de arranque ====== | ====== Usar variables de entorno en tiempo de arranque ====== |
informatica/linux/docker.txt · Last modified: 2023/03/16 10:18 by jose