1

I have configured ECS containers. Everything works, however when I'm connecting to a container through SSH, there are no environment variables that are defined in a task definition. Is there a way to persist them? enter image description here enter image description here

Greg Askew
  • 34,339
  • 3
  • 52
  • 81
kozlone
  • 93
  • 1
  • 6
  • 1
    Are you ssh'd into the container, or a ec2 instance hosting the container? – KHobbits Jun 10 '20 at 12:02
  • The 1st option. I am using Fargate launch type. – kozlone Jun 10 '20 at 12:28
  • @kozlone your django container is running an ssh daemon inside of it? – jordanm Jun 10 '20 at 15:06
  • No, you can't persist environment variables that not present in the task definition. they will disappear when the process dies. – jordanm Jun 10 '20 at 15:07
  • @jordanm > your django container is running an ssh daemon inside of it? Yes, it does for sure. > No, you can't persist environment variables that not present in the task definition. they will disappear when the process dies Could you please provide details about it? I'm expecting hat all my env variable will be passed to a container, like `docker run ... -e ENV_VARIABLE` does it. So, is there any info about how ECS starts containers? – kozlone Jun 11 '20 at 16:34
  • 1
    SSH starts a new session, with a fresh set of environment variables. `docker exec` does not do that, which you can only use if you are *not* running fargate. – jordanm Jun 11 '20 at 16:38
  • @jordanm so, my guess was correct. Thank you :) P. S. You may want to submit the comment as an answer, so I can mark it as a solution. – kozlone Jun 14 '20 at 11:17

0 Answers0