The cause is in the file. Here: how compose applies an edit.
A container gets its environment, ports and image when it is created: they can only change with a new container. docker compose up -d does that on its own — it compares each service's description with its container. The description changed — Recreate: the old container is removed and a new one is created in its place. It did not change — Running, and the container stays as it is.
docker compose restart <service> restarts the same container, and compose.yaml is not read: the environment stays as it was. restart is for another case — when a file mounted into the container through volumes has changed. The program rereads such a file when it starts, and up -d does not compare its contents.
Fix backend
Make backend run and curl http://localhost:8080/ answer with its page, backend: production. The stack is ~/stack/compose.yaml; leave the application code in ~/stack/app alone.
Goals · 0 of 2
- Run backend with a corrected environment not done yet
- Get the site's requests through to backend not done yet