0

I'm kind of stuck,

I have a docker container that is running, and that container runs some elasticsearch inside. But I forgot to use volume on the first deploy. So my container has lots of data inside, in a single folder in /app/data.

I would like to use the same container but use volume on that folder, without losing data inside...

So it will be possible to rebuild other containers to use the same volume.

Have you some tips to share?

Sigdev
  • 392
  • 3
  • 15
  • 1
    [Duplicate] This may be the answer: https://stackoverflow.com/questions/28302178/how-can-i-add-a-volume-to-an-existing-docker-container – Bandi Feb 05 '21 at 10:33

1 Answers1

1

The important thing is not to remove your container, or you'll lose all that data. I think docker cp is your friend here (docs here). Copy the data to the host, then start another container with a volume. Once you've secured your data, you can stop and remove the first container.

Aldo
  • 302
  • 1
  • 7