dongzantai7570 2018-12-20 00:44
浏览 347
已采纳

运行在dockerfile中构建main.go

I'm trying to run go build hello.go inside a dockerfile, as

FROM golang

COPY hello.go /go/src/hello.go

RUN cd src/

RUN go build hello.go

RUN ./hello

It all goes well until the go build command, then it the following error message appears:

stat hello.go: no such file or directory
The command '/bin/sh -c go build hello.go' returned a non-zero code: 1

However, if I comment the last two commands on the dockerfile and run the created image, I can run the go build command with no problems.

Why is this happening?

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥20 51单片机实训实验报告
      • ¥15 C# 循环读写数据中途突然变慢
      • ¥15 用Java实现双端队列
      • ¥150 ID3决策树实现分类
      • ¥15 multisim10安装后,找不到NI License Manager的程序来安装许可证
      • ¥15 C++银行卡系统 Help!
      • ¥15 R语言数据分析的相关问题
      • ¥15 模型导入SP后贴图纹理只有一个,拆了四张UV的,怎么解决?
      • ¥15 检索带order by 非常慢
      • ¥20 python 爬虫 token 加密方式