简体   繁体   English

Docker的Google Cloud Logging驱动程序

[英]The Google Cloud Logging driver for Docker

I'm not able to authenticate the google cloud driver gcplogs for Docker despite the fact that I've set the env var GOOGLE_APPLICATION_CREDENTIALS to the path/file where the JSON credentials of my service account is. 我无法验证Docker的google云驱动程序gcplogs ,尽管我已将env var GOOGLE_APPLICATION_CREDENTIALS设置为我的服务帐户的JSON凭据所在的路径/文件。 The error message is the following: 错误消息如下:

ERROR: for oncrm_oncrm_1  Cannot start service oncrm: failed to initialize logging driver: google.DefaultTokenSource: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

The configuration I'm using on docker-compose is: 我在docker-compose上使用的配置是:

logging:
      driver: gcplogs
      options:
        gcp-project: "gcloud-project-id"
        gcp-meta-name: "prod-helpsec-01"
        labels: "app"

The enviroment I'm trying to run the docker container is: 我正在尝试运行docker容器的环境是:

  • docker-ce v18.03
  • docker-compose v1.21.0
  • Ubuntu 17.10
google.DefaultTokenSource: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

I've had the same problem as above when I've run docker services with gcplogs logging driver. 当我使用gcplogs日志驱动程序运行docker服务时,我遇到了与上面相同的问题。

This is my solution of problem: 这是我的问题解决方案:

On the host machine: 在主机上:

sudo mkdir -p /etc/systemd/system/docker.service.d

Create file: 创建文件:

/etc/systemd/system/docker.service.d/docker-service-override.conf /etc/systemd/system/docker.service.d/docker-service-override.conf

with this content: 有这个内容:

[Service]
Environment="GOOGLE_APPLICATION_CREDENTIALS=/root/gcp-logging-service-cridentials.json"

Restart docker service: 重启docker服务:

sudo systemctl daemon-reload
sudo systemctl restart docker

Useful links: 有用的链接:

  1. https://cloud.google.com/docs/authentication/getting-started https://cloud.google.com/docs/authentication/getting-started
  2. https://docs.docker.com/config/daemon/systemd https://docs.docker.com/config/daemon/systemd
  3. https://docs.docker.com/config/containers/logging/gcplogs/ https://docs.docker.com/config/containers/logging/gcplogs/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 适用于Docker的Google Cloud日志记录驱动程序不收集日志 - Google Cloud logging driver for docker doesn't collect logs 在Digital Ocean上通过docker compose使用docker gcplogs(Google Cloud Logging驱动程序) - Using docker gcplogs (Google Cloud Logging driver) on digital ocean with docker compose Stackdriver Log Agent-与适用于Docker的Google Cloud Logging驱动程序无关的日志级别 - Stackdriver Log Agent - Log Level Irrelevant with Google Cloud Logging Driver for Docker Docker 容器中的 Python 日志记录未在 Google Cloud Logging 中显示为正确的严重性 - Python Logging in Docker container not shown as proper severity in Google Cloud Logging 重新启动后,Google Cloud Logging驱动程序找不到凭据 - Google Cloud Logging Driver cannot find credentials after reboot Docker:日志记录驱动程序对日志的影响 - Docker: effect of logging driver on logs Docker流利的记录驱动程序用于多行 - Docker Fluentd Logging Driver For multiline 配置的日志驱动程序不支持读取:Docker - configured logging driver does not support reading : Docker 使用docker syslog日志记录驱动程序处理日志文件 - log file handling with docker syslog logging driver mac 上 docker 中的 awslogs 日志驱动程序出现 NoCredentialProviders 错误 - NoCredentialProviders error with awslogs logging driver in docker at mac
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM