Aller au contenu principal

Docker

Gestion des containers Docker sur l'infrastructure EFC.

Standards EFC

Tout docker-compose doit inclure:

services:
app:
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
environment:
- TZ=America/Montreal
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"

Commandes utiles

# Status containers
docker ps -a

# Logs
docker logs -f <container>

# Restart
docker restart <container>

# Cleanup
docker system prune -af

Backup volumes

# Backup
docker run --rm -v <volume>:/data -v $(pwd):/backup \
alpine tar czf /backup/volume-backup.tar.gz /data

# Restore
docker run --rm -v <volume>:/data -v $(pwd):/backup \
alpine tar xzf /backup/volume-backup.tar.gz -C /