Removing unused Docker containers

Those who work with Docker know how fast is free space disappearing, especially, in case you are experimenting with some new features and don’t pay much attention to cleaning up. As the result, a lot of empty untagged containers can eat tens of gigabytes of space.

Here is the one-liner I found to be very useful for removing old stuff:

docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm

Actually, I’m not the one who came up with this answer, but I spent a few hours trying different commands and googling for the answer.

Here is the full Docker cheat sheet that I bumped into and found it being quite good itself:

Using renderables in Buildbot custom steps

Currently, I’m being widely involved in customization of Buildbot instances. Many questions arise, but no answers are usually available on the Web.

Recently, I designed a custom build step which by the definition needed to work with values from properties passed to it on the init time. The challenge was to make it understanding everything that can theoretically be passed – build properties (IProperty), plain values etc.

In this case, we can use ‘renderables’ list to specify mapping from variables that can contain properties to variables that are used to store rendered values.

We can use passed values without caring to handle it as property or some other renderable. Buildbot does it automatically

class MyStep(BuildStep):
    renderables = ['renderable1' , 'renderable2']

    def __init__(self, passed_var1, passed_var2):
        self.renderable1 = passed_var1
        self.renderable2 = passed_var2

Invoke the step in the build factory as:

MyStep(util.Prop(property1), util.Prop(property2))


MyStep('actual value 1', 'actual value 2')

Now we can use passed values simply as without caring to handle it as property or some other renderable. Buildbot does it automatically.