[英]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: 有用的链接:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.