Creating CQL schemas in a cassandra image and saving the image


I would like to run create some CQL schemas in a cassandra Image and save the image so that I don’t have to recreate the schemas each time.

Using the following logic, it says that the ports are not open.

FROM cassandra
ADD file.cql /
RUN cqlsh -f /file.cql

I tried using a script that waits for port 9042 to open, but it does not open.
I tried using EXPOSE 9042 and still the same issue.

Does the FROM command open the ports? If not, then what is the solution to my problem.

I have the same problem ,finally I did the
docker exec -it containername cqlsh -f filename

after bringing up the container.
I am still looking for a solution where I can do this inside the Dockerfile