Closed
Description
Disclaimer: I'm not normally a Go developer, so some of my terms may not be quite right.
I'm trying to build a Docker plugin that use the go-plugins-helpers
from Docker and I wanted the binary to run in Docker alpine
, but alpine
doesn't have the linked dynamic binaries or whatever, so I was reading up that I need to set CGO_ENABLED=0
when building. I've tried a few different build commands, including:
CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-s' -o bin/linux/amd64/local-persist -v
CGO_ENABLED=0 go build -a -tags netgo -a -o bin/linux/amd64/local-persist -v
(Tried that last one with and without CGO_ENABLED
flag. No error, but still won't run in alpine
.)
I keep getting this error:
../github.com/docker/go-plugins-helpers/sdk/unix_listener.go:12:2: no buildable Go source files in /go/src/github.com/coreos/go-systemd/util
make: *** [binary-linux-amd64] Error 1
Steps to reproduce yourself:
git clone https://github.com/CWSpear/local-persist
cd local-persist
docker run -it -v `pwd`:/go/src/app golang:onbuild bash
# now you'll be inside the docker container, next run:
export CGO_ENABLED=0
go get -v -d
go build [whatever flags] .