I have environment variable file like follow name .env-template
export S3_BASE_FOLDER_URL="oa-eui-dev-plt-env-kpidev-oa"
export AWS_ACCESS_KEY_ID=""
export AWS_SECRET_ACCESS_KEY=""
export AWS_DEFAULT_REGION="us-west-1"
export DB_HOST="host.docker.internal"
export DB_NAME="bcpdemo"
export DB_USER="SA"
export DB_PASS="1234Qwer!"
export BATCH_IMPORT_JOB_NAME=""
AWS_BATCH_JOB_ARRAY_INDEX=0
while running docker run command like
docker run --env-file env_template --name bcpbatchcontainer bcpbatchimage
It is shwoing follwoing error
docker: open env_template: The system cannot find the file specified.
See 'docker run --help'.
If I pass env variable with -e
it is not showing any problem. But I need to pass with file.
According to docs you have to use relative path (./
).
This works for me:
docker run --env-file ./.env-template <your_image>
Also your .env
file doesn't need export
, this works:
S3_BASE_FOLDER_URL="oa-eui-dev-plt-env-kpidev-oa"
AWS_ACCESS_KEY_ID=""
AWS_SECRET_ACCESS_KEY=""
AWS_DEFAULT_REGION="us-west-1"
DB_HOST="host.docker.internal"
DB_NAME="bcpdemo"
DB_USER="SA"
DB_PASS="1234Qwer!"
BATCH_IMPORT_JOB_NAME=""
AWS_BATCH_JOB_ARRAY_INDEX=0
If you try to maintain export
word it throws an error:
docker: poorly formatted environment: variable 'export S3_BASE_FOLDER_URL' contains whitespaces.