i have a solution with the following docker-compose file:
version: '3.6' services: my_solr: container_name: mySolr volumes: - type: bind source: "/E:/Docker/Solr" target: "/opt/solr/server/solr/mycores/myCore" image: solr:7.7.2 ports: - "8983:8983" # to invoke the Solr admin console http://localhost:8983/ entrypoint: - bash - "-c" - "precreate-core myCore; exec solr -f" networks: - app-net my_server: container_name: myServer environment: munixoserversettings: "someSettings" build: ./ # this build-command is using a already existing dockerfile ports: - "9898:9898" depends_on: - my_solr networks: - app-net volumes: - type: bind source: "/E:/Docker/MyServer" target: "/usr/novimnt" networks: app-net: volumes: v:
The first service my_solr has some commands in the entrypoint segment to prepare the container for a specific extension, it is called a “core”. The extension is a set of xml-files. Currently I insert them into the container by the following sequence:
1.) Invoke docker-compose with my docker-compose-file with the command “up”.
docker cp C:\Users\admin\Source\Repos\MySolrExtensions mySolr:/opt/solr/server/solr/mycores/
3.) Restart both containers.
I do not want to make the steps as described above. I want one docker-compose-file, that copies everything to the right place a that’s it.
Can I create a second Dockerfile that invokes the following
- “precreate-core myCore; exec solr -f”
and copies my extension to the image?