I'm trying to dockerize cassandra by following below steps. Docker file ->
FROM oraclelinux:7.3
COPY apache-cassandra-2.2.8-bin.tar.gz /opt
RUN cd /opt && tar -xvzf apache-cassandra-2.2.8-bin.tar.gz
RUN cd /opt && ln -s apache-cassandra-2.2.8 cassandra
RUN cd /opt/cassandra && mkdir data && mkdir commitlog && mkdir saved_caches
COPY cassandra.yaml /opt/cassandra/conf
COPY cassandra-topology.properties /opt/cassandra/conf
RUN chmod +x /opt/cassandra/bin/cassandra
ENV CASSANDRA_CONFIG /opt/cassandra/conf
ENV CASSANDRA_HOME /opt/cassandra
RUN /opt/cassandra/bin/cassandra
ENTRYPOINT ["/opt/cassandra/bin/cassandra"]
EXPOSE 7000 7001 7199 9160
When I build cassandra docker using
docker build -t my_cassandra .
throws below error message
Step 19/21 : RUN /opt/cassandra/bin/cassandra
---> Running in 36bd332c523a
cat: /etc/ld.so.conf.d/*.conf: No such file or directory
When I build cassandra docker using
docker run -it my_cassandra bin/bash
it throws same error message
cat: /etc/ld.so.conf.d/*.conf: No such file or directory
If I remove the ENTRYPOINT line or hash it out, docker builds and runs fine but cassandra doesn't run as part of docker run command. I have to logon to the container and manually start with ./cassandra
Is there a way I could start cassandra as part of docker run command here?
From your example above, it doesn't look like ENTRYPOINT is the problem here. You should not run Cassandra as part of the Docker build.
Step 19/21 : RUN /opt/cassandra/bin/cassandra
---> Running in 36bd332c523a
cat: /etc/ld.so.conf.d/*.conf: No such file or directory
Remove RUN /opt/cassandra/bin/cassandra.
Take a look at the official Cassandra Docker Image on Docker Hub.
link: Official Dockerfile
link: Docker Hub - Cassandra
It boils down to the upstream image you use. /opt/cassandra/bin/cassandra seems to be a shell script which executes which ldconfig at some point. If which is missing from your image, you will see such error