Remove terminated/unused docker containers from your system

Problem

After playing around with docker containers for some time the terminated/unused ones are still hanging around your system, and prevent you from using a new container with the same name as any of the previous ones with the error:

Error response from daemon: Conflict. The name "container_name" is already in use by container 61f023f06a98. You have to remove (or rename) that container to be able to reuse that name.

Solution

You can remove all the containers by using the following:

docker rm $(docker ps -aq)

git apply name_of_file.patch does not work

Problem

You are given a patch file to apply to your git repository but using git apply does not work. No errors reported but no changes applied neither.

Solution

Try to use the patch command command possibly with the -p1 parameter like:

patch -p1 < path_to_the_patch_file.patch

NOTE: Make sure that you are in the right folder relative to the file path in the patch file