I spent sometime researching on this, but still not clear on how ECS environment variables are safe to use in terms of security but ENV & ENV-FILE options for docker or not?
For example: AWS ECS documentation states that add secrets to task definition and they will be available as container environment variables.
Docker documentation has similar language:
The environment variables set using ENV will persist when a container is run from the resulting image. You can view the values using docker inspect, and change them using docker run --env =.
Now, the question I am couldn't find answer for is, if both options setting environment variables within container (which means can be viewed by users when docker inspect), what is the advantage of going with AWS ECS environment variables?
What is the best strategy to get the variables (like dbuser, dbpassword) from AWS parameter store (or) SSM but don't set them to container environment variables (If possible without using docker entryscript)?