L
L
LittleBuster2019-04-24 04:48:25
go
LittleBuster, 2019-04-24 04:48:25

Golang application freezes when starting on Docker?

Everything is going well, but when you start the application just hangs without outputting anything to the console, what could be?

FROM golang:1.11.9-alpine

RUN apk update && apk upgrade && \
    apk add --no-cache bash git

RUN mkdir -p /go/src/app

WORKDIR /go/src/app

COPY . /go/src/app

RUN mkdir -p /etc/futcamp/
RUN mkdir -p /var/log/futcamp/
COPY ./router.conf /etc/futcamp/

RUN go get

RUN go install

CMD ["app"]

EXPOSE 8080

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2019-04-24
@LittleBuster

Run the container from the second console docker exec -it <containername> sh
And start poking around in it. In particular, try in a similar way by calling app to try to start the application. Perhaps the executable flag is not set, or you need to run it like this: ./app
Notes on the dockerfile:

  • RUN commands, if possible, should be blinded, for example: RUN go get && go installThis way you will reduce the number of layers in your image
  • Didn't find what you were looking for?

    Ask your question

    Ask a Question

    731 491 924 answers to any question