0

I am using "wurstmeister/kafka" docker image with latest tag. Whenever I tried to stop & start the kafka container, it will start container with default configuration. How can I mount volume, so that data persists even when container stops or automatically restarts.

All data saved in logs file inside provided folder in volume, but when container restarts it doesn't load data from that folder & starts fresh copy.

I have tried following :

volumes:
  - /kafka:/kafka-volume

When container restarts, all topics should be persists as it is and with same partitions created earlier.

Any help would be appreciable.

Bhavik Shah
  • 31
  • 1
  • 6

1 Answers1

0

Add this in your compose file

services:
    kafka:
      volumes:
        - type: volume
         source: kafkalogs
         target: /path/to/folder/on/host
  volumes:
   kafkalogs:
asolanki
  • 1,333
  • 11
  • 18
  • All data stores in folder specified in volume in log file, but I am not able to access that whenever container restarts. It always starts a fresh copy with no data inside it. – Bhavik Shah Jul 24 '19 at 08:48