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.

  • How do I get my dreamweaver site to use my nginx docker container as a web test server?
  • kubernetes and debugging it in general
  • Using host filesystem as a read-only base in docker
  • How to add multiple interfaces to docker container and set ip addresses manually?
  • docker-compose.yml vs docker-stack.yml what difference?
  • Where is the Docker JSON file logging driver writing files to?
  • 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 !

  • Why are my non-volume data in Docker container persistence after restarting the container?
  • communication between containers in docker
  • How does .NET Core on Linux determine what port a SQL Server instance listens on?
  • How to make host interfaces, including cni* accessible in kubernetes privileged pods?
  • Dockerizing multiple instanced of a node app with different arguments
  • Elastic Beanstalk Django Deployment With Preconfigured Docker Container
  • 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.