Problem during running docker build

Hi,

I wanted to implement microservices application with elastic apm using docker so followed this guide.

Guide link

I am new to docker. However i faced issue running docker-compose up --build. Please help resolve.
OS: centos 7

Building auth-api
Step 1/9 : FROM golang:1.9-alpine
---> b0260be938c6
Step 2/9 : EXPOSE 8081
---> Using cache
---> 6776678a08f2
Step 3/9 : WORKDIR /go/src/app
---> Using cache
---> 0d0646e1d9bc
Step 4/9 : RUN apk --no-cache add curl git && curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
---> Using cache
---> 7516bdffa2f9
Step 5/9 : COPY . .
---> 04d289b4ee40
Step 6/9 : RUN dep ensure
---> Running in 9dd3b5794931
Removing intermediate container 9dd3b5794931
---> 1a010eb88412
Step 7/9 : RUN dep ensure -update golang.org/x/sys
---> Running in 9357ff5a3f22
Removing intermediate container 9357ff5a3f22
---> c2de5ad5d991
Step 8/9 : RUN go build -o auth-api
---> Running in d48ba80be329

#app/vendor/github.com/elastic/go-sysinfo/providers/aix
exec: "gcc": executable file not found in $PATH
ERROR: Service 'auth-api' failed to build: The command '/bin/sh -c go build -o auth-api' returned a non-zero code: 2

After some research i added alphine-sdk in Dockerfile under auth-api folder.

RUN apk add --update alpine-sdk

Error got resolved but getting other error now.

Step 8/11 : RUN dep ensure
---> Running in 9711a810ca23
Removing intermediate container 9711a810ca23
---> 12c5bfc79f7e
Step 9/11 : RUN dep ensure -update golang.org/x/sys
---> Running in 38d3e613aa31
Removing intermediate container 38d3e613aa31
---> 44b55351a1c0
Step 10/11 : RUN go build -o auth-api
---> Running in 493b67abeab6

#app/vendor/github.com/elastic/go-sysinfo/providers/aix
vendor/github.com/elastic/go-sysinfo/providers/aix/host_aix.go:23:25: fatal error: libperfstat.h: No such file or directory
 #include <libperfstat.h>
                         ^
compilation terminated.
ERROR: Service 'auth-api' failed to build: The command '/bin/sh -c go build -o auth-api' returned a non-zero code: 2

Thanks and regards,
Bryce Fernandes.

For Go 1.9 you'll need to pin elastic/go-sysinfo to v1.3.0. If you can update to a newer version of Go with support for modules, you'll probably have a better time.

1 Like

Hi @axw ,

Thanks for the reply, changed the version and it worked :smiley: .

replaced
FROM golang:1.9-alpine
with
FROM golang:1.15.2-alpine

Thanks and regards,
Bryce Fernandes.

1 Like