Docker

docker run with arguments

Declares env variables with ENV:

ENV thing default_thing_value
ENV thing2 default_thing2_value

Then you can pass the env variables with docker run.

docker run -p 9000:9000 -e thing=bwallberg -e thing2=1337 -d

If using docker-compose

node:
  environment:
    - environment=dev
    - cluster=0

Your Dockerfile CMD can use the env variables but you need use sh -c:

CMD ["sh", "-c", "node server.js ${cluster} ${environment}"]