I modified the docker-compose.yml
file as given on https://hub.docker.com/_/solr/ by adding a volumes
configuration and a change in entrypoint
. The modified file is as given:
version: '3'
services:
solr:
image: solr
ports:
- "8983:8983"
volumes:
- ./solr/init.sh:/init.sh
- ./solr/data:/opt/solr/server/solr/mycores
entrypoint:
- init.sh
- docker-entrypoint.sh
- solr-precreate
- mycore
I need to run this 'init.sh' before entrypoint starts, to prepare my files inside container.
But I get following errors:
ERROR: for solr_solr_1 Cannot start service solr: oci runtime error: container_linux.go:247: starting container process caused "exec: \"init.sh\": executable file not found in $PATH"
Earlier I found about official image hooks in neo4j from here. Is there a similar thing I can use here also?
Update 1: From comments below, I realized that dockerfile set WORKDIR /opt/solr
due to which executable file not found in $PATH
. So I tested by providing the absolute path to entrypoint by using /init.sh
. But this also gives error, but a different one:
standard_init_linux.go:178: exec user process caused "exec format error"
./init.sh
and it gave same error but then I tried/init.sh
and that givespermission denied
. – PompeyWORKDIR /opt/solr
, so I guess it looks forinit.sh
in that path. – Auntpermission denied
, so you might to make sure thatinit.sh
has+x
in the permissions (chmod +x init.sh
) – Roorbackpath not found
. So I tried giving absolute path Update: My fault @Roorback , the/init.sh
gives permission denied when the file was not present. I mounted at wrong place. After mounting correctly, I gotexec format error
. Anyone knows how entrypoint works? – Pompeyinit.sh
file. fix that withchmod
locally and rebuild the image. – Auntexec format error
– Pompeydocker-compose exec solr bash
and try to run the scripts if you still have problems. It's normally a lot easier to troubleshoot inside the container. – Auntdocker exec
will effect just my system. So I want it to be done by docker-compose. – Pompey