Exited docker container を断捨離する

#Exitしたコンテナを片付けたい
dockerを使って、検証をしているうちにこんなことに……。

```
CONTAINER ID        IMAGE                            COMMAND                  CREATED             STATUS                    PORTS                              NAMES
4ef7fb56356b        import_test:now                  "/bin/bash"              6 days ago          Exited (0) 6 days ago                                        clever_mestorf
0f29f484a338        import_test:now                  "/bin/bash"              6 days ago          Exited (0) 6 days ago                                        confident_mccarthy
1c03ee93861f        9336b91c9831                     "/usr/sbin/apache2..."   6 days ago          Exited (0) 6 days ago                                        admiring_montalcini
074751f8bd1f        9336b91c9831                     "/bin/bash"              6 days ago          Exited (0) 6 days ago                                        gracious_ardinghelli
085fa362b0a2        9336b91c9831                     "/bin/bash"              6 days ago          Exited (0) 6 days ago                                        modest_swirles
0e875a2ee5b6        9336b91c9831                     "/sbin/init"             6 days ago          Exited (137) 6 days ago                                      admiring_khorana
61e5fd4266cb        9336b91c9831                     "/bin/bash"              6 days ago          Exited (0) 6 days ago                                        epic_snyder
5fff4e48b448        9336b91c9831                     "/usr/sbin/apache2..."   6 days ago          Exited (0) 6 days ago                                        frosty_colden
7c72cc8d1d94        9336b91c9831                     "/usr/sbin/apache2..."   6 days ago          Exited (0) 6 days ago                                        eager_jennings
37c97f98c614        9336b91c9831                     "/bin/bash"              6 days ago          Exited (0) 6 days ago                                        angry_mccarthy
73c7a869eda3        9336b91c9831                     "/bin/bash"              6 days ago          Exited (0) 6 days ago                                        optimistic_banach
822cd368a3b3        centos:latest                    "/bin/bash"              6 days ago          Exited (0) 6 days ago                                        eloquent_wiles
e710e96e10c6        ubuntu:14.04                     "/bin/bash"              6 days ago          Exited (0) 6 days ago                                        modest_hopper
73316f7b8231        ubuntu:14.04                     "/bin/bash"              6 days ago          Exited (0) 6 days ago                                        upbeat_saha
28c289811e70        ubuntu:14.04                     "/bin/bash"              6 days ago          Exited (0) 6 days ago                                        practical_nightingale
```

こまめに掃除するために、aliasで掃除を簡単にするdocker rmコマンドを仕込む。

```
alias docker-rma='sudo docker rm $(sudo docker ps -a | grep Exited | cut -f1 -d" ")'
```

すっきり！
全部片付けちゃうので、本当に捨ててよいかは一度確認したほうが良いです。

```
$ docker-rma
4ef7fb56356b
0f29f484a338
1c03ee93861f
074751f8bd1f
085fa362b0a2
0e875a2ee5b6
61e5fd4266cb
5fff4e48b448
7c72cc8d1d94
37c97f98c614
73c7a869eda3
822cd368a3b3
e710e96e10c6
73316f7b8231
28c289811e70
```