1

I have this sample docker-compose.yml:

version: "2"

networks:
  default:
    external:
      name: simple-monitor_zeebe_network

services:
  ods:
    container_name: auto-auction-service
    image: cargeeks/auto-auction-service:SNAPSHOT
    environment:
      - SERVICE_LOG_LEVEL=debug
      - client.broker.contactPoint=172.20.0.6:26500
    ports:
      - "9200:7100"
    networks:
      - default

Somewhere in my microservice, I have code like this which attempts to resolve the client.broker.contactPoint environment variable.

 String contactPoint = System.getenv("client.broker.contactPoint");
            if (StringUtils.isEmpty(contactPoint)) {
                _logger.info("Environment variable " + ENV_CONTACT_POINT + " is not defined.  Using default " + DEFAULT_CONTACT_POINT);
                contactPoint = DEFAULT_CONTACT_POINT;
            }

When I run docker-compose up against the docker-compose.yml file defined above, the contactPoint is always defined to the DEFAULT_CONTACT_POINT.

What am I doing wrong here?

1 Answer 1

2

Try without a dot-separated variable name. Some environments either do no allow this or try and interpret them as a hierarchical reference. Use underscores instead, both in the Docker-compose file and the code.

Sign up to request clarification or add additional context in comments.

1 Comment

Yea, that was the problem. CLIENT_BROKER_CONTACT_POINT works instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.