User Tools

Site Tools


informatica:linux:docker

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
informatica:linux:docker [2019/09/10 09:03] – [Usar variables de entorno en tiempo de arranque] javiinformatica:linux:docker [2020/04/09 09:01] javi
Line 35: Line 35:
  
   sudo service docker restart   sudo service docker restart
 +
 +===== Habilitar debug =====
 +
 +https://success.docker.com/article/how-do-i-enable-debug-logging-of-the-docker-daemon
 +
 +1. Editar:
 +
 +  sudo vim /etc/docker/daemon.json
 +
 +Y añadir:
 +
 +<code>
 +{
 +    "debug": true
 +}
 +</code>
 +
 +2. Recargar el servicio:
 +
 +  sudo kill -SIGHUP $(pidof dockerd)
 +  
 +3. Ver logs
 +
 +  sudo tail -F /var/log/daemon.log
 +  
 +
 +
  
 ====== 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://docs.docker.com/config/containers/start-containers-automatically/
 +
 +Miramos que política tiene:
 +  docker inspect container_name| jq -r '.[0].HostConfig.RestartPolicy'
 +<code>
 +{
 +  "Name": "always",
 +  "MaximumRetryCount": 0
 +}
 +</code>
 +
 +^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 1332: Line 1376:
  
 </code> </code>
 +
 +===== does not match any of the regexes: '^x-' =====
 +
 +Error completo:
 +
 +<code>
 +ERROR: The Compose file './docker-compose.rafa.yml' is invalid because:
 +networks.network-rafa-db value 'network-proxy' does not match any of the regexes: '^x-'
 +</code>
 +
 +**Causa**
 +
 +Un bloque, en este caso dentro de networks, no está alineado correctamente
 +
 +**Solución**
 +
 +1. Identificar el bloque, en este caso "networks"
 +
 +2. Revisar las entradas. Una de ellas tiene un espacio de más o de menos
 +
informatica/linux/docker.txt · Last modified: 2023/03/16 10:18 by jose