Docker Community Forums

Share and learn in the Docker community.

Feature Request: Keep files after container removal


(Bálint Antal) #1

If I remove a container with linked Volumes, it removes those folders linked to it.

I run several databases for example in Docker and when our devops says, they upgraded the database, I update the containers to the right version. Now, I have to unlink the volume first. If I forget that, it will automatically remove the folder too.

It would be good to at least have a prompt that reminds me about it is going to remove those sources.


(Klamar) #2

What about mounting a folder to the container. That is what I do for databases:

version: '2'
services: 
  db:
    volumes:
    - ./data/mysql:/var/lib/mysql

(Bálint Antal) #3

Yup, but in this case I’m talking about the Kitematic GUI.

An example:

  • I have a container
  • ~/Kitematic/my-container/data is linked to /var/lib/data for example

If I remove the container from the Kitematic GUI, it removes ~/Kitematic/my-container/data. That’s my problem here. :frowning:


(Klamar) #4

Ah, sorry, was not aware you are talking about kitematic. For me this sounds like a bug. Without knowing kitematic it should propably ask you if you want to remove the files. Docker is not doing it, so it is a “feature” of the GUI application.