ようへいの日々精進XP

よかろうもん

(超メモ)AWS SDK で Signature not yet current: 20151018T000614Z... というエラーが出た際の対処

何が起きた?

Ubuntu サーバー上で動かしていた Docker 1.9.0-dev で Log Driver に CloudWatch Logs を利用している際に以下のようなエラーに遭遇。

$ docker run --rm -i -t \
>   --log-driver=awslogs \
>   --log-opt awslogs-region=ap-northeast-1 \
>   --log-opt awslogs-group=docker-log \
>   --log-opt awslogs-stream=hello-world \
> hello-world
Error response from daemon: Cannot start container 5ec548413d2d1b24c34b3cf552d4616130f5da0552f623785eb403983d3a6270: Failed to initialize logging driver: InvalidSignatureException: Signature not yet current: 20151018T000614Z is still later than 20151018T000104Z (20151017T235604Z + 5 min.)
        status code: 400, request id: []

原因と対処

原因

  • 時刻のズレ

対処

  • 時刻のズレを直す
# 直す前
$ date
Sun Oct 18 09:07:27 JST 2015

# 直す
$ sudo ntpdate ntp.ubuntu.com
18 Oct 08:59:45 ntpdate[18694]: step time server 91.189.94.4 offset -610.069478 sec

対処後

$ docker run --rm -i -t \
>   --log-driver=awslogs \
>   --log-opt awslogs-region=ap-northeast-1 \
>   --log-opt awslogs-group=docker-log \
>   --log-opt awslogs-stream=hello-world \
> hello-world

Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/userguide/

CloudWatch Logs にも。

f:id:inokara:20151018091637p:plain

ヨカタ。


参考

stackoverflow.com

有難うございます。