0

So say I have a bash script that takes two arguments.

./myBash.sh 123 "123123"

Cool we can do something like

index=$1 
location=$2

How do I use those arguments in a docker command within myBash.sh

like:

docker exec myDockerContainer_1 bash -c 'myMigrationScript --pw=$location  --pwOld=1234 --indexToStartAt=$index'

But this doesn't seem to work? The variables do not get carried over inside the docker container?

1 Answers1

0

If you set this in your Dockerfile

ENTRYPOINT ["bash", "-c"]
CMD ["/path/to/myBash.sh"]

Then you only need

docker run --rm image arg1 arg2
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245