0

I want to create a docker image with cassandra and already some keyspace/tables/data in it. The image is necessary for testing, and we have quite much data we need, so I don't want to load it in docker-entrypoint.sh, so that container gets up fast.

This is my simplified Dockerfile, but obviously it doesn't work:

FROM cassandra:3.11

COPY cql cql

RUN cqlsh -f /cql/001_create_keyspace.cql 

As I just learned, cassandra is not running when I try to issue RUN cqlsh.

Is there some way to run it, load the data, and then stop cassandra? Or is there any other way to create cassandra image with the data already loaded?

1 Answer 1

1

You could import the data in a running container, commit that container and thereby create a new image.

Sign up to request clarification or add additional context in comments.

2 Comments

I think that's good idea! I want the container to be easy to recreate, but I can write some scripts for that. Thanks!
Unfortunately, this doesn't work :( Cassandra image creates volume for data, and all the changes to data, like keyspace, tables etc, are stored on the volume, not inside the container. docker commit only stores changes made to the container :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.