【发布时间】:2015-11-07 06:56:32
【问题描述】:
请注意,当我在笔记本电脑上运行代码时,代码运行良好。
以下两组代码将在我的笔记本电脑上运行。但是,第二组(使用我的自定义包)在运行 docker 的 Elastic Beanstalk 上不起作用。
仅限标准库
import (
"net/http"
"os"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "3000"
}
http.ListenAndServe(":"+port, nil)
}
使用自定义包
import (
"os"
"github.com/sim/handlers"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "3000"
}
handlers.ServeAndHandle(port) // wrapper of ListenAndServe
}
错误信息:
Failed to build Docker image aws_beanstalk/staging-app: andlers: exit status 128 [0mtime="2015-08-14T05:08:17Z" level="info" msg="The command [/bin/sh -c go-wrapper download] returned a non-zero code: 1" . Check snapshot logs for details.
2015-08-14 01:08:15 UTC-0400 WARN Failed to build Docker image aws_beanstalk/staging-app, retrying...
cron.yaml
version: 1
cron:
- name: "task1"
url: "/scheduled"
schedule: "* * * * *"
【问题讨论】:
-
你用 docker 在你的机器上试过了吗?可能只是包的一些依赖项,它存在于您的机器上,但在您在弹性 beantalk 中使用的 docker 映像中缺失。
-
你也可以发布你的 Dockerfile 吗?
-
@ydaetskcoR 我没有 dockerfile。我认为 Elastic beanstalk 会为您服务。也许我应该创建一个。
标签: amazon-web-services go docker amazon-elastic-beanstalk