Global environment variables in a shell script with Dockerfile

  bash, docker, dockerfile, script, sh

I’m trying to create a ENV VAR called SETTINGS in a Python image with Dockerfile. This env var must be dynamic, because I need to change the conf profile betweet production and preproduction.

I’ve created an script (entrypoint.sh) with two commands, the first one create the SETTINGS VAR and the second one is a python command.

The problem is that the python line works properly but the SETTINGS var doesn’t.

Script

#!/bin/bash
profile=$profile
export SETTINGS=/acalls-service/${profile}.cfg
python -m "_acalls_clasiffier" 
exec

Dockerfile

ENTRYPOINT ["/bin/bash", "-c", ". entrypoint.sh"]

I’ve tried with ["./entrypoint.sh] also but I doesn’t work.

Source: Docker Questions

LEAVE A COMMENT