To list only the containers SHA1:
docker ps -aq --no-trunc
That way, you can use the list of all containers for other commands (which accept multiple container ids as parameters).
For example, to list only the name of all containers (since docker ps list only their names with other information):
docker inspect --format='{{.Name}}' $(sudo docker ps -aq --no-trunc)