I was cleaning up dangling images in docker, and I accidentally removed the production database container as well.

Its not a big issue, I can just up the container back and everything should be fine. But after I up the container and connected to the database, I found out there's no data inside. I thought I fucked up, and sent msg in slack channel that I nuked the db.

Later my friend asked me which compose file I am using and that's when I realized I used the wrong config to up the db. Used the correct config to up the database again and everything goes back to normal.

It's friday evening and if I really dropped the db it would be fucking bad weekend....

  • 0
    This is why I have been too scared to run a DB in docker so far
  • 2
    Thanks to you, now I can enjoy my weekend.
  • 3
    The thing is.

    When you just take a teeny weeny bit of time....

    You could do the following:

    - script
    - fetch list of protected container attributes (names, tags)
    - fetch list of images to expunge
    - walk over, chunk by fixed size, excluding protected containers
    - nuke that shit.

    I'd recommend this over and over simply because - once it's tested - it will spare you _so much pain_.
Add Comment