【发布时间】:2019-07-21 15:40:20
【问题描述】:
我已按照here 的指示进行操作,在我重新启动计算机之前一切正常。重启后,docker daemon 似乎失去了对 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 google-cloud-platform systemd google-cloud-stackdriver