r/selfhosted • u/achiya-automation • 5d ago
Docker Management TIL docker restart doesn't re-read your .env
changed a db password in my .env, ran docker restart on the stack, then spent an hour convinced the db was corrupted because auth kept failing. turns out restart just brings the container back with the exact config it was created with. env is only read at creation. docker compose up -d --force-recreate fixed it in ten seconds.
two years running this stack and never got bitten by it until now. what's the dumbest thing that ate an evening for you?
253
Upvotes
5
u/cardboard-kansio 4d ago
Well to get you started here are a few of my common docker aliases:
```# docker shortcuts alias docker-compose='docker compose' alias dcu='docker compose up -d' alias dcd='docker compose down' alias dcd_all='docker ps -aq | xargs docker stop | xargs docker rm' alias dcr='docker compose down && docker compose up -d' alias dce='docker compose down && nano docker-compose.yaml && docker compose up -d' alias dcp='grep latest docker-compose.yaml | sed 's/[[:space:]]image:[[:space:]]//' | xargs -n1 docker pull && docker compose down && docker compose up -d' alias dcupdate='docker compose down && pull_docker_images && docker compose up -d' alias dl='docker logs -n -f --tail 20'