Closed vikas027 closed 7 years ago
Hi @vikas027,
The problem seems to come from your Docker daemon which is in trouble when trying to run the image.
Can you please double check that you can run other docker images, etc and that your docker daemon works correctly. Run for example docker run hello-world
Thanks for the quick reply @fsenart. I ran the same script on OS X 10.11.2 and everything ran fine.
Not sure what, but there is something not right somewhere.
I cannot doubt my Docker installation/configuration as I am running docker on an AMI which is running lots of Docker production workloads. Here is the output of the command anyways.
# docker run 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 ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
Also, I believe -d
switch (after base64
) is not required in this command. You might wanna update Makefile
> Invoke AWS Lambda function
+ aws lambda invoke --function-name golang-preview --invocation-type RequestResponse --log-type Tail /dev/stderr --query LogResult --output text
+ base64 -d
+ grep -o '[0-9\.]\+ ms'
+ head -1
+ xargs -0 echo -n ' executed in'
base64: invalid option -- d
Usage: base64 [-dhvD] [-b num] [-i in_file] [-o out_file]
-h, --help display this message
-D, --decode decodes input
-b, --break break encoded string into num character lines
-i, --input input file (default: "-" for stdin)
-o, --output output file (default: "-" for stdout)
The docker daemon cannot initialize the logging driver due to the name of the log stream. The error says that the log stream name must not have ":" in it but eawsy/aws-lambda-go-shim:latest
violate this rule.
It is very weird because I can't imagine that we cannot run an image by precising the tag we need.
What is clear is that the problem is not related to the preview.bash script but to the way the Makefile run the docker image.
Let test something more simple, docker run --rm -it eawsy/aws-lambda-go-shim:latest version
. To see if the docker daemon is able to configure the right log stream.
Hmm, yeah Docker is unable to run this container
# docker run -it --rm -it eawsy/aws-lambda-go-shim:latest version
docker: Error response from daemon: Failed to initialize logging driver: InvalidParameterException: 1 validation error detected: Value 'eawsy/aws-lambda-go-shim:latest/dazzling_hamilton/6c9e7bf6c9c39037ee485937aca7c67c76f259b7db36ac3b4b5015d9c32e0d72' at 'logStreamName' failed to satisfy constraint: Member must satisfy regular expression pattern: [^:*]*
status code: 400, request id: c55a29d0-41f6-11e7-ad58-a10df8a6004e
I have found the issue. We are using awslogs
as Docker logging driver. Looks like this image doesn't like this driver (not sure the reason though). I can run the docker
command if I specify the log driver along with other switches
# docker run -it --log-driver=json-file --rm -it eawsy/aws-lambda-go-shim:latest version
2017-05-24
Now to fix the issue in the preview.bash
script, I have inserted below line at line 52
sed -i 's/docker run/docker run --log-driver=json-file/' Makefile
Overall, I am all set now.
Cheers.
@vikas027 the preview.bash is here only to jump in the project easily. And the Makefile is provided for being fully customized for your needs. So if you need to run the Docker image in your AMI, abandon the preview.bash, download the Makefile and just change anything you want in it. It is only here as an example so moreover than using a sed command, I advocate on creating a custom makefile for your use cases. Anyway, if you have any other problem in the future, do not hesitate ;) Happy Go on Lambda!
Yeah, I will tweak the Makefile
according to my needs. Thanks.
I am encountering below error on CentOS 7.
Here is the detailed log
This is my go environment.