Cleanup after Docker

I often find myself in a situation where I have several redundant Docker containers and/or images; usually after development of a new container/image and forgetting to use a flag like run --rm.

Unfortunately, Docker doesn’t provide a built-in command to cleanup after itself.

Instead, one must call Docker’s remove commands with the output of Docker’s list commands.

To remove all containers:

$ docker stop $(docker ps -a -q)
$ docker rm $(docker ps -a -q)

To remove all ‘untagged’ images:

$ docker rmi $(docker images | grep "^<none>" | awk "{print $3}")

Now read this

OS X @ permissions and quarantine

Whilst correcting the permissions of my ssh key files on my Mac, I noticed a permissions flag that I hadn’t seen before, an @ sign. $ ls -la > -r--------@ 1 bmaher staff 1.7K 4 May 2017 id_rsa Turns out that this signifies that OS X... Continue →