docker - 重新启动后 Google Cloud Logging 驱动程序找不到凭据

标签 docker google-cloud-platform systemd google-cloud-stackdriver

我已按照指示 here ,一切正常,直到我重新启动计算机。重新启动后,docker 守护进程似乎失去了对 Google 凭据的跟踪。

$ docker run --log-driver=gcplogs ...
失败:
docker: Error response from daemon: failed to initialize logging driver: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
ERRO[0000] error waiting for container: context canceled
这对我来说很奇怪,因为运行 $ systemctl show --property=Environment docker返回我的 systemd 配置中的值:
Environment=GOOGLE_APPLICATION_CREDENTIALS=/etc/path/to/application_default_credentials.json
如果我 $ sudo systemctl restart docker , 然后 docker 成功运行并将日志发送到 stackdriver。但我希望这个 docker 镜像在启动时自动运行,并使用 sudo 重新启动 docker碍事。
有没有办法用必要的环境变量初始化 docker 守护进程,所以 gcplogs 可以在启动时准备好而无需重新启动 docker?

最佳答案

我安装了两个版本的 docker - 一个通过将 docker 的 repo 添加到 apt,一个通过 snap。运行

sudo systemctl list-unit-files| grep docker | grep enabled

展示了 docker 的两个安装:
docker.service                             enabled    
snap.docker.dockerd.service                enabled

安装两个 docker 会导致启动问题。我删除了 snap 安装,重新启动,现在一切正常。

关于docker - 重新启动后 Google Cloud Logging 驱动程序找不到凭据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54913571/

相关文章:

ssl - 在 Google Compute Engine 实例上安装 SSL 证书

google-cloud-platform - 可以在没有外部 IP 的情况下连接到 Compute Engine 吗?

linux - Android 平台工具 : "A stop job is running for Session 2 of UserX",,我必须等待 90 秒才能断电

docker - digital ocean 内的所有容器都停止滴落

docker - 如何 "reset"docker-compose systemd 服务?

python - 操作系统错误: [Errno 13] Permission denied when initializing Celery in Docker

heroku - apt-get无法使用docker + dokku中的自定义source.list来找到软件包

docker - 如何从Docker容器中获取已发布的端口?

linux - 使用 Annoy 库中的 mmap() 在 Docker 容器之间共享 RAM

firebase - 获取具有等于特定字符串的字段的 Firestore 文档