René's URL Explorer Experiment


Title: DefaultCredentialsError (only sometimes) in Google Compute Engine with docker · Issue #2995 · googleapis/google-cloud-python · GitHub

Open Graph Title: DefaultCredentialsError (only sometimes) in Google Compute Engine with docker · Issue #2995 · googleapis/google-cloud-python

X Title: DefaultCredentialsError (only sometimes) in Google Compute Engine with docker · Issue #2995 · googleapis/google-cloud-python

Description: Hello, I run a python script hourly, embedded in a docker container hosted on a Google Compute Engine instance. That script includes a step where I use python lib google.cloud.storage to upload files in google storage. I want to use the ...

Open Graph Description: Hello, I run a python script hourly, embedded in a docker container hosted on a Google Compute Engine instance. That script includes a step where I use python lib google.cloud.storage to upload fil...

X Description: Hello, I run a python script hourly, embedded in a docker container hosted on a Google Compute Engine instance. That script includes a step where I use python lib google.cloud.storage to upload fil...

Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/2995

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"DefaultCredentialsError (only sometimes) in Google Compute Engine with docker","articleBody":"Hello,\r\n\r\nI run a python script hourly, embedded in a docker container hosted on a Google Compute Engine instance. That script includes a step where I use python lib google.cloud.storage to upload files in google storage.\r\n\r\nI want to use the default service account of the compute engine instance. As written in the [doc](https://google-cloud-python.readthedocs.io/en/latest/google-cloud-auth.html), authentication should “just work”. And most of the time it does.\r\n\r\nYet I quite often get the error:\r\nFile \"/usr/local/lib/python2.7/dist-packages/google/auth/_default.py\", line 282, in default raise exceptions.DefaultCredentialsError(_HELP_MESSAGE)\r\ngoogle.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credential and re-run the application. For more information, please see https://developers.google.com/accounts/docs/application-default-credentials.\r\n\r\nMy code:\r\n```\r\nimport google.auth\r\nfrom google.cloud import storage\r\n...\r\ncredentials, projectId = google.auth.default()\r\n# Next line raises sometimes the exception\r\nclient = storage.Client(projectId, credentials=credentials)\r\n...\r\n```\r\n\r\nWhen I run a python CLI from that same docker container, and call the `credentials, projectId = google.auth.default()`, I can see that the credentials are a `google.auth.compute_engine.credentials.Credentials object`, so I guess that the \"magic\" works even in a container (the doc does not explain how it works though).\r\n\r\nAny explanation on how to make it work, using the service account from the host compute instance ?\r\n\r\nMy env:\r\n* OS: ubuntu:16:04 (compute instance and docker instance)\r\n* python 2.7.12\r\n* google-cloud-storage==0.22.0, google-auth==0.5.0\r\n","author":{"url":"https://github.com/gjanvier","@type":"Person","name":"gjanvier"},"datePublished":"2017-02-10T09:11:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":14},"url":"https://github.com/2995/google-cloud-python/issues/2995"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:be49f069-2f6a-8fdd-83f3-01463acf887a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB404:15BB0E:51777F:6EB940:6A4D3E3A
html-safe-nonce322229488bf95636b40fe3aa3cd84153ed86a582b7ae2d6b296394e24a3264c1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDA0OjE1QkIwRTo1MTc3N0Y6NkVCOTQwOjZBNEQzRTNBIiwidmlzaXRvcl9pZCI6IjUxOTgzNzQ5MzY0ODE5NzE3NzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac27a63abb41f1b5bbae3002f0558f03ebf60cc5a5755c455a3fd0590cd2ecea52
hovercard-subject-tagissue:206743605
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-python/2995/issue_layout
twitter:imagehttps://opengraph.githubassets.com/8df47fd85783bea786f35acb1af46913ed0e4b43d091be9af07f4032e16ed132/googleapis/google-cloud-python/issues/2995
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/8df47fd85783bea786f35acb1af46913ed0e4b43d091be9af07f4032e16ed132/googleapis/google-cloud-python/issues/2995
og:image:altHello, I run a python script hourly, embedded in a docker container hosted on a Google Compute Engine instance. That script includes a step where I use python lib google.cloud.storage to upload fil...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamegjanvier
hostnamegithub.com
expected-hostnamegithub.com
None92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6
turbo-cache-controlno-preview
go-importgithub.com/googleapis/google-cloud-python git https://github.com/googleapis/google-cloud-python.git
octolytics-dimension-user_id16785467
octolytics-dimension-user_logingoogleapis
octolytics-dimension-repository_id16316451
octolytics-dimension-repository_nwogoogleapis/google-cloud-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id16316451
octolytics-dimension-repository_network_root_nwogoogleapis/google-cloud-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release56fc8347865a14e2ec811533d68f929cf4e0ec19
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/googleapis/google-cloud-python/issues/2995#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fgoogle-cloud-python%2Fissues%2F2995
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fgoogle-cloud-python%2Fissues%2F2995
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=googleapis%2Fgoogle-cloud-python
Reloadhttps://github.com/googleapis/google-cloud-python/issues/2995
Reloadhttps://github.com/googleapis/google-cloud-python/issues/2995
Reloadhttps://github.com/googleapis/google-cloud-python/issues/2995
Please reload this pagehttps://github.com/googleapis/google-cloud-python/issues/2995
googleapis https://github.com/googleapis
google-cloud-pythonhttps://github.com/googleapis/google-cloud-python
Notifications https://github.com/login?return_to=%2Fgoogleapis%2Fgoogle-cloud-python
Fork 1.7k https://github.com/login?return_to=%2Fgoogleapis%2Fgoogle-cloud-python
Star 5.3k https://github.com/login?return_to=%2Fgoogleapis%2Fgoogle-cloud-python
Code https://github.com/googleapis/google-cloud-python
Issues 437 https://github.com/googleapis/google-cloud-python/issues
Pull requests 127 https://github.com/googleapis/google-cloud-python/pulls
Discussions https://github.com/googleapis/google-cloud-python/discussions
Actions https://github.com/googleapis/google-cloud-python/actions
Projects https://github.com/googleapis/google-cloud-python/projects
Security and quality 0 https://github.com/googleapis/google-cloud-python/security
Insights https://github.com/googleapis/google-cloud-python/pulse
Code https://github.com/googleapis/google-cloud-python
Issues https://github.com/googleapis/google-cloud-python/issues
Pull requests https://github.com/googleapis/google-cloud-python/pulls
Discussions https://github.com/googleapis/google-cloud-python/discussions
Actions https://github.com/googleapis/google-cloud-python/actions
Projects https://github.com/googleapis/google-cloud-python/projects
Security and quality https://github.com/googleapis/google-cloud-python/security
Insights https://github.com/googleapis/google-cloud-python/pulse
DefaultCredentialsError (only sometimes) in Google Compute Engine with dockerhttps://github.com/googleapis/google-cloud-python/issues/2995#top
https://github.com/gjanvier
authhttps://github.com/googleapis/google-cloud-python/issues?q=state%3Aopen%20label%3A%22auth%22
https://github.com/gjanvier
gjanvierhttps://github.com/gjanvier
on Feb 10, 2017https://github.com/googleapis/google-cloud-python/issues/2995#issue-206743605
dochttps://google-cloud-python.readthedocs.io/en/latest/google-cloud-auth.html
https://developers.google.com/accounts/docs/application-default-credentialshttps://developers.google.com/accounts/docs/application-default-credentials
gjanvierhttps://github.com/gjanvier
authhttps://github.com/googleapis/google-cloud-python/issues?q=state%3Aopen%20label%3A%22auth%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.