I look around but don't find a runnable solution.
What I want: I want to create a Windows Batch file to build my docker-compose envirenment and pass througth some parameters, like Username and Password. But the parameters don't comes in docker-composer.
My minimal script:
@echo off
set arg1=%1
set arg2=%2
IF "%arg1%" == "" GOTO wrongPara
IF "%arg2%" == "" GOTO wrongPara
set ADMIN_USER="%arg1%"
set ADMIN_PASSWORD="%arg2%"
docker-compose build --no-cache
docker-compose up --build --force-recreate
GOTO end
:wrongPara
echo All Parameters are needed. $1 = Username, $2 = Password
:end
echo Finished
my Docker-Compose File is:
grafana:
image: grafana/grafana
hostname: grafana
container_name: grafana
ports:
- "3000:3000"
links:
- prometheus
depends_on:
- prometheus
restart: always
environment:
- GF_SECURITY_ADMIN_USER=${ADMIN_USER}
- GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD}
I run the Batch-Script for example:
install.bat admin password
So I want to set grafana user is "admin" and password is "password"
but both are empty. What do I wrong?