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

431
Visualizações
Azure build pipeline, docker compose - set environment variable

I have a build pipeline that runs a docker image with some java program that is run using maven.

enter image description here

Selected pipeline step Run automation tests is starting docker-compose that starts my java program inside docker, as you can see I also set system environment value FEATURES_LIST with some test value, now inside my java program, I tried to return value of like I normally do for environment variables:

System.getenv("FEATURES_LIST");

But it never finds it, If on another hand, I specify environment variable, inside my docker compose file, it finds it (some different env variable set on the bottom of the docker compose file, see below)

version: '3.4'

services:

  # SELENIUM GRID
  selenium-hub:
    image: selenium/hub
    ports:
      - 4444:4444

  chrome:
    image: selenium/node-chrome-debug
    ports:
      - 5900:5900
    environment:
      - HUB_PORT_4444_TCP_ADDR=selenium-hub
      - HUB_PORT_4444_TCP_PORT=4444
    depends_on:
      - selenium-hub

  # AUTOMATION PROJECT
  image_name:
    image: imagepathhere:latest
    volumes:
      - ./:/usr/src/app/
    network_mode: "host"
    depends_on:
      - chrome
    environment:
      - TARGET_TEST_ENV=uat

Trouble is, it would really make my life easier, if I could specify environment variable inside azure build pipeline, is there something I am doing wrong?

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

0

The "Environment Variables" in the Docker Compose task not inject the variables into the containers so the Java application can't read them, but they are will be available in the agent during the process.

The variables are for use in the docker-compose.yml in this way: ${variableName}.

So you can define in the Docker Compose task variable: FEATURE_LIST=blabla and in the docker-compose.yml inject the variable into the container:

image:ubuntu:latest
environment:
  - FEATURE_LIST=${FEATURE_LIST}

In this way you can specify environment variables inside Azure Build Pipeline (but you must also define them in the docker-compose.yml).

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