Setting Dynamic Env variable in Docker

I am trying to set dynamic env variable in Docker but somehow it resets.
I want to set an ENV variable which has value :

export EC2_Region=$(curl -s 

so i cant just use ENV in Dockerfile since its not static.

  • Sandbox command execution with docker via Ajax
  • Backup/Restore a dockerized PostgreSQL database
  • How do I access a USB drive on a OSX host from inside a docker container?
  • Bamboo Mesos Marathon
  • how to link two single container AWS Elastic Beanstalk environments
  • Possible to host private docker registries?
  • I tried making an and used CMD[""] in Dockerfile but when i attach to the docker process, the env variable is empty.

    I am fairy new to docker and still exploring options.

    Thanks in advance !

  • docker-compose links between app and db
  • How can I make /etc/hosts writable by root in a Docker Container?
  • docker suspend and resume using criu
  • create-react-app + docker = QA and PROD Deploy
  • Google cloud sdks doesn't start preview for Docker image Mac OS
  • Dockerizing PostgreSQL
  • One Solution collect form web for “Setting Dynamic Env variable in Docker”

    You can use ENTRYPOINT instead of CMD.

    Example Dockerfile:

    FROM ubuntu:14.04
    COPY /
    RUN chmod +x /
    ENTRYPOINT ["/"]

    export EC2_Region=$(curl -s
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.