Docker Compose Solr server and curl as client



examples/solr/docker-compose.yml
version: '3.8'
services:
  client:
    build: .
    volumes:
    - .:/opt
    links:
    - solr
    command: tail -f /dev/null
  solr:
    image: solr:latest

examples/solr/Dockerfile
FROM ubuntu:22.04
RUN apt-get update && \
    apt-get install -y curl

Start the docker containers


docker-compose up -d

Connect to the docker container which has curl installed:


docker exec -it solr_client_1 bash


curl http://solr:8983/solr/

TBD:


curl --request POST \
--url http://solr:8983/api/collections \
--header 'Content-Type: application/json' \
--data '{
  "create": {
    "name": "techproducts",
    "numShards": 1,
    "replicationFactor": 0
  }
}'