You encounter the error because Postfix is unable to resolve the localhost.
To resolve the issue, check the /etc/hosts file and make sure that the localhost address is 127.0.0.1.
For example:
127.0.0.1 hostname.localdomain HOSTNAME localhost localhost.localdomain
