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.

  • Lift Sails inside Docker container
  • How to start mysql server in docker container
  • Does the Docker RPM require additional dependencies?
  • docker 1.12 swarm : Does Swarm have a configuration store like kubernetes configMap
  • Docker Postgres data volume on the host
  • How to handle IP addresses when linking docker containers with each other using docker-compose?
  • 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 !

  • boot2docker / docker “Error. image library/.:latest not found”
  • Guidance needed - how to track nginx-docker-rails performance issue
  • Does docker support command aliases similar to Git aliases?
  • openconnect in dockers/IBM bluemix (Error: TUNSETIFF failed: Inappropriate ioctl for device)
  • docker mysql connection via php
  • Docker with App_Data volume?
  • 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.