Cleaning up workspace

In section 6 the first option for removing all containers and images by those commands :“docker container rm -f $(docker container ls -aq)” , “docker image rm -f $(docker image ls -aq)”
have not worked.

The error is:"Unknown shorthand flag: ‘a’ - in -qa
see ‘docker rm --help’ "

How is it possible at all that this is happening to me?

Try the followings:

docker container rm -f ${docker container ls -aq}

docker image rm ${docker image ls -q}

Ye, I had the same issue. I think it is because of certain docker version. I upgraded to from 20.10.12 to 20.10.14, then this command works.