emperorspride188
emperorspride188

Reputation: 889

Use docker environment path variable in bash script

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.

Upvotes: 1

Views: 543

Answers (1)

Mathers
Mathers

Reputation: 184

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>

Upvotes: 1

Related Questions