Link to the code that reproduces this issue
https://github.com/VojtechVidra/next-16.3.3-env-docker-issue
To Reproduce
- Build the application with docker
docker build . -t next-env-issue
- Run the built image
docker run -p 3000:3000 next-env-issue
- Open the route file in browser http://localhost:3000/api/env
Current vs. Expected behavior
Current:
When I build with docker build and run it, the endpoint is returning null for both env variables.
Expected:
The variables are defined even when using docker build.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.6.0: Fri Jul 31 19:18:49 PDT 2026; root:xnu-12377.161.14~5/RELEASE_ARM64_T6000
Available memory (MB): 32768
Available CPU cores: 10
Binaries:
Node: 24.19.0
npm: 11.17.0
Yarn: N/A
pnpm: 11.23.0
Relevant Packages:
next: 16.3.3 // Latest available version is detected (16.3.3).
eslint-config-next: N/A
react: 19.2.3
react-dom: 19.2.3
typescript: 5.9.3
Next.js Config:
output: standalone
Which area(s) are affected? (Select all that apply)
Runtime
Which stage(s) are affected? (Select all that apply)
Other (Deployed)
Additional context
No response
Link to the code that reproduces this issue
https://github.com/VojtechVidra/next-16.3.3-env-docker-issue
To Reproduce
docker build . -t next-env-issuedocker run -p 3000:3000 next-env-issueCurrent vs. Expected behavior
Current:
When I build with docker build and run it, the endpoint is returning null for both env variables.
Expected:
The variables are defined even when using docker build.
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 25.6.0: Fri Jul 31 19:18:49 PDT 2026; root:xnu-12377.161.14~5/RELEASE_ARM64_T6000 Available memory (MB): 32768 Available CPU cores: 10 Binaries: Node: 24.19.0 npm: 11.17.0 Yarn: N/A pnpm: 11.23.0 Relevant Packages: next: 16.3.3 // Latest available version is detected (16.3.3). eslint-config-next: N/A react: 19.2.3 react-dom: 19.2.3 typescript: 5.9.3 Next.js Config: output: standaloneWhich area(s) are affected? (Select all that apply)
Runtime
Which stage(s) are affected? (Select all that apply)
Other (Deployed)
Additional context
No response