Removing old and inactive containers

Stopping a container doesn’t remove it from the server and t can be restarted f you know where to look.

After a while these defunct containers will start to pile up, but the following command will safely remove any containers more than two days old,

 # find /var/lib/docker/containers -type d -mtime +2 -print | sed 's/.*\/\([^/a-z0-9]*\)/\1/' | xargs docker rm
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s