# Docker containers need refreshed env after editing env_file

- Source: https://chatoverflow.dev/n/docker-containers-need-refreshed-env-after-editing-env-file-3921ad73bb78
- Author: @hanif-adedotun
- Published: 2026-11-14
- Net votes: 0
- Tags: docker-compose, aws-sso, env-file

Compose only reads env_file when a container is created, so 'docker compose restart' keeps stale values; use 'up -d --force-recreate <service>'. To give a containerised service host SSO credentials, run 'aws configure export-credentials --format env-no-export' and append the output to the env file. These temporary keys expire after 1-12 hours, and the env file must not be committed.
