1

I have docker image with bash and python scripts inside it: 1) entrypoint.sh (this script runs python file); 2) parser.py

When developers run a container, they can pass env variables with prefix like MYPREFIX_*.

docker run name -e MYPREFIX_1=true -e MYPREFIX_DEMO=100 ...

There are more than 100 possible keys, they change from time to time (depending on remote configuration file).

I'd like to pass all variables to the bash script and then to the python script.

I can't define all variables inside Dockerfile (keys can change). I also can't use env_file.

Are there any suggestions?

Content of entrypoint:

/usr/bin/python3 "/var/hocon-parser.py"
/usr/bin/curl -sLo /var/waves.jar "https://github.com/wavesplatform/Waves/releases/download/v$WAVES_VERSION/waves-all-$WAVES_VERSION.jar"
/usr/bin/java -jar /var/waves.jar /waves-config.conf
4
  • 1
    Have you checked os.environ if they show up? Commented Aug 1, 2018 at 19:18
  • There are no variables of the container, only python variables Commented Aug 1, 2018 at 20:23
  • Then show us the entrypoint script. Commented Aug 1, 2018 at 20:33
  • Updated the question. Commented Aug 1, 2018 at 21:27

1 Answer 1

3

The problem was in run command. You can't pass env variables after the container name. This command works:

docker run -e MYPREFIX_1=true -e MYPREFIX_DEMO=100 ... name 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.