List all stopped containers
docker ps -a -f status=exited
Delete all stopped containers
docker rm $(docker ps -aq -f status=exited)
Stop all containers
docker stop $(docker ps -q)
List all images
docker images
Delete useless images
docker rmi $(docker images -q -f dangling=true)
Restart a stopped container with a new command
# Identify stopped container
docker ps -a
# Commit container
docker commit <container_id> <a_new_name>
# Start new session (make sure to re-use volume mounts, ports etc)
docker run ... <a_new_name> <a_new_command>