Google API API凭据存储不能与docker一起使用

我正在尝试构build一个Flask应用程序来执行某种Google表单操作。 我的应用程序完全按照预期在localhost [ python app.py ]中运行。 但是,当我build立一个Docker容器然后运行时,执行卡在凭证存储指令中。 credentials = tools.run_flow(flow, storage=store, flags) 我正在关注这个文档 。

我的get_credentials()如下

 def get_credentials(): home_dir = os.getcwd() credential_dir = os.path.join(home_dir, 'credentials') if not os.path.exists(credential_dir): os.makedirs(credential_dir) credential_path = os.path.join(credential_dir, 'api_credentials.json') store = Storage(credential_path) credentials = store.get() if not credentials or credentials.invalid: flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES) flow.user_agent = APPLICATION_NAME if flags: credentials = tools.run_flow(flow, storage=store, flags) else: # Needed only for compatibility with Python 2.6 credentials = tools.run(flow, store) return credentials