I am having a bash script, that is running inside a docker container.
This bash script is invoked by my wrapper python script. Arguments are passed through python script.
Bash script has a line to do ssh and get the result out.
When I am running this, I am not getting ssh output in my host terminal, from where I am running the script.
This is my section of bash script
function query_function () {
test_variable1=`curl -ks "$sp_hostname" | grep ",active" | egrep -v "$excluded_hostnames" | egrep "[.,]$1" | egrep ",$2| $2" | cut -d "," -f 2 | sort`
for f in `echo $test_variable1`; do
output=''
echo 'SERVER:' $f
ssh -i "key_file" -o "StrictHostKeyChecking no" -q $f "$3"
echo $'\n'
done
exit 0
}
This is how I call my docker container to run script.
$ docker run -it --rm --net host nnarayanan-wrapper morpheus vm appdb 'command'
1) Confirmed python script invokes bash script
2) Confirmed that bash script is taking the passed arguments
3) I am not getting any output while doing an ssh inside a docker container through bash script in my host machine terminal
Most likely in your image you do not have a curl
and egrep
.
So I suggest you add to your Dockerfile this:
...
# Install prerequisites
RUN apt-get update && apt-get install -y curl egrep
...
I hope it will help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.