I have Java-Spring-Maven project, which builds a docker image. I define "DATABASE_USER" variable.
My docker-compose.yml:
. . . 
my-service:
    build: my-service/
      context: .
      args:
        - DATABASE_USER=${DBUSR}
    container_name: my-service
    command: java -jar -Xms256M -Xmx1g
      -Dfile.encoding=UTF-8
 . . . . . . 
 
    environment:
      - DATABASE_USER=${DBUSR}
 . . . . . . 
In my dockerfile a have commands:
ARG DATABASE_USER
RUN ....
I want to pass the DATABASE_USER variable from docker-compose.yml to the RUN command in dockerfile.
The problem is that my variable DATABASE_USER is empty. I tried ENV DATABASE_USER, ARG DATABASE_USER=$DATABASE_USER and many other combinations. What is wrong? What is my mistake?
Thank you!
I tried ENV DATABASE_USER, ARG DATABASE_USER=$DATABASE_USER and many other combinations.
