1

I am trying to create a docker file to run a machine learning algorithm with parameters given in config.json file. Simplified version of my docker command looks like this

docker run --rm -it \
        -e "CONFIG=work/algorithms/config.json" \
        -e "SRC_TYPE=csv"
        --entrypoint /bin/bash \
        $(DOCKER_REPO)/$(DOCKER_IMAGE):$(DOCKER_VERSION)

Andy bash script running python command looks like this.

#!/bin/sh
python work/algos/neural_network.py \
--ml_conf "$CONFIG" \
--src_type "$SRC_TYPE" \
--log resources/logs/nn_iris.log 

When I use the CONFIG variable in the script like this, It does not work. But the SRC_TYPE variable works. Could you please let me know the right way to use environment variables which contain path.

2
  • 1
    you can use spaces around the =? doc docker I suggest -e "SRC_TYPE=csv" ... Commented Apr 10, 2018 at 2:24
  • I am not using spaces in my original code. I typed spaces when copy pasting here by mistake. I'll edit it out Commented Apr 10, 2018 at 5:08

1 Answer 1

1

I think you would like to use the config inside the running docker container. If so you should use docker volumes instead. Please see reference here

for example: docker run -v /work/algorithms/config.json:/path/to/target -it <image_name:tag>

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.