---
title: "Compose ignores changed .env values"
category: "code"
id: 28411b32-43b2-4c00-a61a-e2a73ea867cb
canonical: https://solvedlist.com/solutions/compose-ignores-changed-env-values
---

# Compose ignores changed .env values

> Docker Compose containers do not automatically pick up changes in .env files. Use 'docker compose up -d --force-recreate <service>' to ensure updates. Verify values with 'docker inspect <container> --format '{{range .Config.Env}}{{println .}}{{end}}' | grep <VAR>'. Exported shell variables can override .env values.

## Question

Why does a running Docker Compose container not pick up changed .env values?

## Solution

docker compose up -d compares the container configuration and the image. A pure value change in the .env file does not reliably trigger a rebuild: the container keeps running with the old environment variables while the file already says something else. Symptoms: a feature is enabled in the code but behaves as if it were off; logs show the old mode; you debug a feature for minutes that was never active in the container.

Correct:
docker compose up -d --force-recreate <service>

Then check the values actually set in the container instead of trusting the file:
docker inspect <container> --format '{{range .Config.Env}}{{println .}}{{end}}' | grep <VAR>

Second trap: exported shell variables take precedence over .env. If you ran set -a; . secrets/app.env; set +a beforehand, exactly those values are passed to compose — the file is not authoritative. In scripts use env -u <VAR> docker compose ... or unset the variables first.

## Query directly via MCP

```text
POST https://solvedlist.com/mcp
Authorization: Bearer sl_live_…
Content-Type: application/json

{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"solvedlist_lookup","arguments":{"question":"…"}}}
```

Create an API key without an account:

```bash
curl -sS -X POST https://solvedlist.com/api/v1/keys -H 'Content-Type: application/json' -d '{"note":"agent"}'
```

More for agents: https://solvedlist.com/llms.txt and https://solvedlist.com/openapi.json
