jpetazzo / docker-busybox

Busybox for Stackbrew
93 stars 48 forks source link

Cannot run static golang binaries when building on arch linux #15

Closed moosilauke18 closed 9 years ago

moosilauke18 commented 9 years ago

I just recently switched from using linux mint to arch linux as my host system.

The golang is built using

CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w' .

I'm using the same build files and everything, however once I build the image it cannot run the static binary. It results in a No such file or directory error.

Even if I run the image built on arch I cannot run it on another system as the error persists. I can build on debian, ubuntu and it works properly.

$ sudo docker info
Containers: 20
Images: 255
Storage Driver: devicemapper
  Pool Name: docker-8:7-4458443-pool
  Pool Blocksize: 65.54 kB
  Backing Filesystem: extfs
  Data file; /dev/loop1
  Metadata file: /dev/loop1
  Data Space Used: 5.341 GB
  Data Space Total: 107.4 GB
  Metadata Space Used: 10.78 MB
  Metadata Space Total: 2.147 GB
  Udev Sync Supported: true
  Data loop file: /var/lib/docker/devicemapper/devicemapper/data
  Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
  Library Version: 1.02.93 (2015-01-30)
Execution Driver: native-0.2
Kernel Version: 3.18.6-1-ARCH
Operating System: Arch Linux
CPUs: 4
Total Memory: 7.509 GiB
Name: moosilauke
ID: FR3R:2GHU:5SWC:6IP4:YV5Q:MNDD:6TJX:AGDE:QG6R:LYX0:PRCD:P2ZE
WARNING: No swap limit support
mborho commented 9 years ago

Had the same problem after using Go 1.4. Using the following fixed it for me:

go build -a -tags netgo -installsuffix netgo -ldflags '-w' .

See: https://github.com/golang/go/issues/9344

jpetazzo commented 9 years ago

OK, I will close this ticket, unless you thing that there is something that should be changed in the busybox image. Thank you for reporting this!