I need ‘cqlsh’ to execute my build_all.cql. However, ‘cqlsh’ is not ready…it takes about 60 seconds for cqlsh to be ready. How do you do ‘wait’ with Dockerfile?
WORKDIR /docker/cms/db-scripts-2.1.33.2/
RUN cqlsh -f build_all.cql
USER dse
=============
Output:
Step 8/9 : RUN cqlsh -f build_all.cql
—> Running in 08c8a854ebf4
Connection error: (‘Unable to connect to any servers’, {‘127.0.0.1’: error(111, “Tried connecting to [(‘127.0.0.1’, 9042)]. Last error: Connection refused”)})
The command ‘/bin/sh -c cqlsh -f build_all.cql’ returned a non-zero code: 1
Same issue. I tried with 60 seconds still same issue. Increased to 90 seconds same issue.
Is there a way to detect from Dockerfile if cqlsh is ready or not?
Step 16/17 : RUN sleep 90; cqlsh -f build_all.cql
—> Running in 99ca484df871
Connection error: (‘Unable to connect to any servers’, {‘127.0.0.1’: error(111, “Tried connecting to [(‘127.0.0.1’, 9042)]. Last error: Connection refused”)})
The command ‘/bin/sh -c sleep 90; cqlsh -f build_all.cql’ returned a non-zero code: 1
If the command depends on connecting to a running daemon on localhost, it will never be “ready”, since every RUN command starts in a totally clean environment with no running processes.