Docker Community Forums

Share and learn in the Docker community.

Service which runs in background exits

I create my solr image to run it as a service in the docker-compse.

It runs well if I run a container with -dit. Without detach argument, it will exit with code 0. I add the service into the docker compose.

  solr:
    build: ./solr_make
    ports:
      - target: 8900
        published: 8900
    tty: true
    stdin_open: true
    networks:
      - qa_system

I add tty and stdin_open, then run docker-compose up -d. The solr container still exit. It there any way to keep the solr container up? Thank you.

Did you have a look at the official solr image on Dockerhub? https://hub.docker.com/_/solr/

In their Dockerfile they call a special entrypoint script…

ENTRYPOINT [“docker-entrypoint.sh”]
CMD [“solr-foreground”]

Hi, thanks for your reply. I checked the sh file. Didn’t find anything special.
I’m not an expert on shell programming…