The server doesn't respond anymore after I switch framework Gin to Echo

8/14/2019

I used to use Gin(Golang framework) and deploy docker image to GKE. It was working totally fine.

But the server doesn't respond anymore when I switched Gin to Echo(it is also Golang framework)

I think it is because there is something wrong with port combination(port forwarding).

My echo server code is like below.

func main() {
    e := presentation.Router()

    e.Logger.Fatal(e.Start(":8080")) // listen and serve on :8080
}

and my dockerfile is like below.

FROM alpine:3.9

WORKDIR /app
ADD main /app

ENV PORT 80

EXPOSE 80

CMD ["./main"]

When request reaches to 80 port, it has to render to 8080 port (container port). But it doesn't seem that it is working like above at the moment.

How can I match outer port and inner port??

-- tonteki
docker
echo
go
google-kubernetes-engine
kubernetes

1 Answer

8/14/2019

Use the command docker run -p 80:8080 image_name for running the container, it will publish the port 8080 of the container and map it with port 80 of the host.

-- Praveen Rewar
Source: StackOverflow