diff --git a/ansible/library/kolla_docker.py b/ansible/library/kolla_docker.py
index b220a9667e..580692c844 100644
--- a/ansible/library/kolla_docker.py
+++ b/ansible/library/kolla_docker.py
@@ -635,11 +635,15 @@ class DockerWorker(object):
         # We do not want to detach so we wait around for container to exit
         if not self.params.get('detach'):
             rc = self.dc.wait(self.params.get('name'))
+            # NOTE(jeffrey4l): since python docker package 3.0, wait return a
+            # dict all the time.
+            if isinstance(rc, dict):
+                rc = rc['StatusCode']
             if rc != 0:
                 self.module.fail_json(
                     failed=True,
                     changed=True,
-                    msg="Container exited with non-zero return code"
+                    msg="Container exited with non-zero return code %s" % rc
                 )
             if self.params.get('remove_on_exit'):
                 self.stop_container()