Closed bendavis78 closed 3 years ago
Yes, I ran into this, too. I'm adding the wait-for-it
script onto the image to allow for it to be used to handle this.
The wait-for-it script is in the 4.0.2 image now. So you can set your entrypoint like this:
entrypoint: /usr/bin/tini -- wait-for-it elasticsearch:9200 -- /docker-entrypoint.sh
And it will wait for Elasticsearch to start up before starting Graylog.
Using the docker-compose examples from the documentation results in Graylog not being able to connect to elasticsearch, because elasticsearch sometimes takes a bit longer to start up.
The graylog entrypoint script should wait for the elasticsearch server before starting Graylog, otherwise the container will fail and exit.
As a workaround, I've resorted to using
sleep
in my docker-compose to give elasticsearch more time to start up:Note that
depends_on
is not enough to guarantee that the server is accepting connections. According to Docker docs,depends_on
only determines the order in which containers are started. It waits until the container is running before starting the next, but that does not mean that the elasticsearch server is accepting connections yet.