Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

503
Visualizações
how to provide environment variables to AWS ECS task definition?

In the task definition on ECS, I have provided environment variable as following:

Key as HOST_NAME and the value as something.cloud.com

On my local I use this docker run command and I'm able to pass in my env variables, but through task definition the variables are not being passed to container.

The docker run command below works on local, but how do I set it up in the task definition in AWS ECS?

docker run -e HOST_NAME=something.cloud.com sid:latest

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

You should call it name and not key, see example below

 {
  "name": "nginx",
  "image": "",
  "portMappings": [
    {
      "containerPort": 80,
      "hostPort": 80
    }
  ],
  "environment": [
    {
      "name": "HOST_NAME",
      "value": "something.cloud.com"
    }
    ]
 }
over 4 years ago · Santiago Trujillo Relatório

0

If you used the new docker compose integration with ECS, then you will need to update the stack.

It is smart enough to update only the parts that changed. For my case, this was the task definition not picking new environment variables set on a .env file and mounted on the docker container

Run the same command you used to create the stack, only that this time round it'll update it(only parts that changed)

docker compose --context you-ecs-context up -f your.docker-compose.yml

For more: https://docs.docker.com/engine/context/ecs-integration/#rolling-update

over 4 years ago · Santiago Trujillo Relatório

0

You can set hostname var at task definition JSON file

hostname
Type: string

Required: no

The hostname to use for your container. This parameter maps to Hostname in the Create a container section of the Docker Remote API and the --hostname option to docker run.
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda