Environment variables and building

How do I force to take the env variables taken into account when running “docker compose up”?
My docker-compose.yml below should force to install aarch64 elasticsearch. But it does not.
I tried also “docker compose up --build” but this does not help.
When I inspect the container with “docker exec -it 7cd16c5093c2 bash”, I can see the env variables set (printenv). So this is maybe a question to ‘image: sebp/elk:oss-8.1.0.’

version: '3'
services:
  elk:
    image: sebp/elk:oss-8.1.0
    container_name: elk-test
    environment:
      ES_PACKAGE: "elasticsearch-8.3.2-darwin-aarch64.tar.gz"
      KIBANA_PACKAGE: "kibana-8.3.2-darwin-aarch64.tar.gz"
      ES_CORS_ALLOW_ORIGIN: "/https?://(.*)example(.*)/"
    ports:
      - "5601:5601"
      - "9200:9200"
      - "5044:5044"

What makes you think that it should?! Have you checked the entrypoint script and actualy saw that those variables are used to download and configure those set of binaries? Or is it just an assumption that it would, because you found those variable somewhere(!) in the documentation?

It realy depends on the image and application wether an environment variable is processed in the entrypoint script to do something before the main process is started or the main process itself is able to make sense of the environment variable.

Your compose file just starts an image and sets environment variables that are supposed to be used to override default values. See: overriding-variables

Since it seems you want to replace the binaries themself, you will need to build your own custom image. See: building-the-image.

I assume you are using Docker Desktop for Mac, which runs a linux vm that runns the Docker Engine. I am not sure why you think you need darwin-aarch64 binaries, but since the container will be a linux container, you need the linux-aarch64 binaries (if you realy need aarch64 binaries at all).

update: the used base image dose not support aarch64. I am afraid if you want to have your own aarch64 image, you will have to create your very own image.

1 Like