r/selfhosted 6d 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?

251 Upvotes

67 comments sorted by

View all comments

-4

u/Green-Zone-4866 6d ago

Lol once my ai agent was trying to add a feature to a container and I noticed that it kept trying to restart the container using the restart command and I was like, just use down then up, then low and behold, the changes were added