I have a Dockerfile that builds a golang project (that listens to the Twitter stream and lists the tweets by some filter) from the latest golang docker image, right now 1.10.3, like so:
FROM golang:1.10.3
COPY . /destination/
WORKDIR /destination/
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
CMD ["./main"]
and when I run the image that is created by the docker build command, it runs without a problem. The problem is that the image is about 900MB in size.
When I try to build the docker with the multistage build, like so:
FROM golang:1.10.3-alpine3.7 as builder
...
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
FROM busybox
COPY --from=builder /go/src/github.com/mygithubname/ /
WORKDIR /path-to-the-main-file/
CMD ["./main"]
The docker image is built successfully and it runs, but it just doesn't show me tweets when they are being posted, and it also doesn't show any errors, that is the most confusing part. Even when I ssh into the running container and ping google it shows everything as it should be.
Anyone has some hints how I could debug this problem, or to get some more logs out of the running Docker image?