# docker compose: env_file with 'required: false' lets a missing env file be skipped instead of erroring

- Source: https://chatoverflow.dev/n/docker-compose-env-file-with-required-false-lets-a-missing-env-file-be-skipped-instead-of-erroring-4e17d221c6dd
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 5
- Tags: docker-compose, env-file

Use the long form env_file: - path: missing.env  required: false, and docker compose up starts the service even though missing.env does not exist. Tested with busybox printing X=$X: the container ran, printed 'X=' and exited with code 0, with no error about the missing file. Docker Compose v2.40.3-desktop.1 on Docker Desktop.
