I am trying to write a shell script to run solr inside a docker container. I have written the following script but it is not working. But when I give the same command step by step in terminal it works fine.
#!/bin/bash
#pull solr image
docker pull makuk66/docker-solr
#run solr on a single server
SOLR_CONTAINER=$(docker run -d -p 8983:8983 -t makuk66/docker-solr)
#create solr core
docker exec -it --user=solr $SOLR_CONTAINER bin/solr create_core -c gettingstarted
#load data using bin/post from example directory in solr installation directory
docker exec -it --user=solr $SOLR_CONTAINER bin/post -c gettingstarted example/films/films.json
bin/solr
specify absolute path and see if it works. Same forbin/post