delete container while running code example Example 1: remove all containers docker docker rmi $(docker images -q) Example 2: docker remove container docker system prune