[ $davids.sh ] — david shekunts blog

🐳 Remove all Docker containers ☠️

# [ $davids.sh ] · message #191

🐳 Remove all Docker containers ☠️

I was recently surprised when I saw that my colleagues try not to delete Docker containers

(continuation in comments)

#docker

  • @ [ $davids.sh ] · # 673

    We're debugging on my colleagues' Macs, I say: "Delete all containers" - and he tells me: "No, I have data there" - and then I was shocked.

    I don't know, maybe people are used to working on one project where there are only a couple of containers and they don't need more, but since my mid-level days, I realized that instead of constantly keeping containers with data locally, I write fixtures that load the necessary data locally and in tests when the container starts up.

    Therefore, I can always delete containers and not worry, because the necessary data will appear the next time they start up.

    If something more complex is needed, I'll write a script, which I'll also add to the process of starting containers locally.

    This way, the machine is cleaner, there's already data for tests, and colleagues can reuse it, and I switch between projects with a snap of my fingers.

  • @ Artur G · # 676

    "No, I have the source code there!" 😂

    I use a dev container to quickly set up an environment and avoid installing software on my main machine.