If you face this error while working with docker,
Adding --network=host
solves this problem. Keep in mind, use this solution only locally.
As described by docker itself,
--network="host" gives the container full access to local system services such as D-bus and is therefore considered insecure.