This is one of the reasons why the bash manual says:
For almost every purpose, shell functions are preferred over aliases.
dockerid() {
docker ps -a \
| grep -o -E '^[a-z0-9]{12}' -o \
| awk '{printf "%s ",$0} END {print ""}'
}
Although the alias quoting hell goes away by replacing awk with paste
alias dockerid="docker ps -a | grep -o -E '^[a-z0-9]{12}' -o | paste -d ' ' -s"