How to set offsets.retention.minutes?

Hi everyone,

I am trying to learn Kafka and wanted to test offsets.retention.minutes in effect.

I am using a compose file retrieved from

I added offstets.retention.minutes=2 to file and restarted the container but when I check it doesn’t work.

What is the correct way of setting that value?

Thanks in advance.

You’d set a Docker environment variable to do this:


More here on configuring cp-kafka. For any Apache Kafka broker config, prefix it with KAFKA_, replace periods with underscores, and uppercase it.