加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Docker的Google Cloud Logging驱动程序

发布时间:2020-12-16 03:48:04 所属栏目:安全 来源:网络整理
导读:我无法验证Docker的google云驱动程序gcplogs,尽管我已将env var GOOGLE_APPLICATION_CREDENTIALS设置为我的服务帐户的JSON凭据所在的路径/文件.错误消息如下: ERROR: for oncrm_oncrm_1 Cannot start service oncrm: failed to initialize logging driver:

我无法验证Docker的google云驱动程序gcplogs,尽管我已将env var GOOGLE_APPLICATION_CREDENTIALS设置为我的服务帐户的JSON凭据所在的路径/文件.错误消息如下:

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.

我在docker-compose上使用的配置是:

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

我正在尝试运行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.

当我使用gcplogs日志驱动程序运行docker服务时,我遇到了与上面相同的问题.

这是我的问题解决方案:

在主机上:

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

创建文件:

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

有这个内容:

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

重启docker服务:

sudo systemctl daemon-reload
sudo systemctl restart docker

有用的链接:

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读