donglan6777 2019-08-14 02:33
浏览 82

将框架Gin切换到Echo后,服务器不再响应

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??

  • 写回答

1条回答 默认 最新

  • doulong2782 2019-08-14 16:07
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 有人能看一下我宿舍管理系统的报修功能该怎么改啊?链表那里总是越界
  • ¥15 cs loadimage运行不了,easyx也下了,没有用
  • ¥15 r包runway详细安装教程
  • ¥15 Html中读取Json文件中数据并制作表格
  • ¥15 谁有RH342练习环境
  • ¥15 STM32F407 DMA中断问题
  • ¥15 uniapp连接阿里云无法发布消息和订阅
  • ¥25 麦当劳点餐系统代码纠错
  • ¥15 轮班监督委员会问题。
  • ¥20 关于变压器的具体案例分析