douyao1878
douyao1878
2017-02-09 08:12

在Docker容器(Ubuntu)的Windows中创建的Run Go应用程序

  • ubuntu
  • docker

I created very simple application that put to output some text.

My development environment is Windows + Docker for Windows. I created ubuntu container and after build my application in Windows for ubuntu

set GOARCH=amd64
set GOOS=linux
go build -o "myapp"

Then I copy 'myapp' file to shared folder and see it in shared folder of my container. After I try to run it inside container but there is an error

enter image description here

Why can't I run it? Was it built incorrectly or do I try to execute it in some wrong way?

In windows I have this output when I run my exe file and I want something the same in Ubuntu.

enter image description here

UPDATE As suggested I try ./myapp and there is Exec format error

enter image description here

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答