NEXT_PUBLIC_ values are inlined into the client bundle at build timeAt build time, Next.js replaces process.env.NEXT_PUBLIC_API_URL in client code with its literal value. Changing the variable at runtime only affects server code. So rebuild for each environment, or read the value on the server and pass it down. The tempting "Docker doesn't pass environment variables to Node" is wrong: Docker does pass them, and server code sees the new value. The client bundle just never reads it again.