Reputation: 51
I'm trying to run a local script in my docker host on a docker container.
I know it is possible to run it using:
docker exec -i mycontainer bash < mylocal.sh
,
but how do I pass arguments to the mylocal.sh using this method.
Say I want to pass the script contents plus an argument like mylocal.sh argument1
I don't really want to copy the files over from host to container.
Upvotes: 2
Views: 491
Reputation: 51
You can pass arguments to bash script using pipe by using -s option.
docker exec -i mycontainer bash -s argument1 argument2 < mylocal.sh
Upvotes: 3