How can I get environment variables of docker in node js?

I am using docker to run node server.js
In terminal, I execute docker run --env-file .env -p 8080:8080 -d node-web-app and I am trying to use process.env in server.js to get environment variables in docker
However, RangeError: Invalid status code: 0 occurs.
How can I fix it and get the environment variables in docker?
Thanks in advance.

  • Kubernetes service in java does not resolve restarted service/replicationcontroller
  • Docker command can't connect to Docker daemon
  • docker bind-mounting a managed volume
  • Post a Json file to elasticsearch running on Docker, Kitematic on Windows 10
  • Arch Linux, Docker “No space left on device.”
  • apt-get install -f does not resolve dependencies
  • Artifactory pro server behind an nginx frontend
  • How to check the docker-compose file version?
  • Starting postgres service in docker entry script
  • How to see Nginx default page using vagrant docker provider?
  • monax command not found on windows
  • Getting error while starting docker in windows
  • One Solution collect form web for “How can I get environment variables of docker in node js?”

    That error is related to your HTTP handler, not env variables. Make sure you send a valid response.

    docker run -e "test=1" -e "testb=2"
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.