docker-library / cassandra

Docker Official Image packaging for Cassandra
Apache License 2.0
263 stars 281 forks source link

Volume-less flavours #180

Closed kkurczewski closed 1 year ago

kkurczewski commented 5 years ago

Is this possible to add image flavour without hardcoded VOLUME?

I mean image tag would be: 3.11.4-no-volume instead 3.11.4 and will not have VOLUME clause. Old clients can use old convention and don't worry about persistence where others can choose how store that data if at all. I see one usage in tests where at this moment I need to remember to remove volumes.

Note this would be obsolete if https://github.com/moby/moby/issues/18286 will be resolved (and applied in docker-compose).

Any thoughts?

wglambert commented 5 years ago

Other discussions on removing inherent volumes in images https://github.com/docker-library/mongo/issues/306, https://github.com/docker-library/redis/issues/140, https://github.com/docker-library/postgres/issues/404, https://github.com/docker-library/mysql/issues/255

tianon commented 5 years ago

While I agree it's unfortunate Docker doesn't have a feature to disable inherited volumes, I really hesitate to add extra explicit variants that then need to be maintained to support this.

I've been able to work around this and get Cassandra storing data outside the volume successfully with something similar to the following:

FROM cassandra:3
RUN sed -i 's!/var/lib/cassandra!/tmp/cass!g' /etc/cassandra/cassandra.yaml

(Where /tmp/cass gets replaced with whatever directory you want the final image to store data in.)

kkurczewski commented 5 years ago

Yes, that kinda would work but I feel this is little hackish... I need afterall make my own image which will still have dangling empty volume.

Sorry if I'm sound annoying but still I'm not convinced to your standpoint.

Now let me summarize my arguments:

My proposed solution: tag=...;` sed 's/VOLUME.*//1' ./Dockerfile | docker build -t "${tag}-volumeless" . -f -

And that's all. I believe adjusting travis.yml would be sufficient, correct me if I wrong.

Of course, I could keep those volume-less images by myself in my private/public repository, but:

I mean, this is really simple thing to do useful at least for a bunch of people who care to comment about that.