dongpu1908 2018-03-21 06:22
浏览 310
已采纳

Beego-使用docker-compose实施中的端口号,而不是使用app.conf中的端口号

I am trying to run the beego application using docker with the help of docker-compose. I am able access the demo application in http://localhost:8081 URL after running docker-compose up.

docker-compose.yml

version: "2"

services:
  app:
    build: .
    volumes:
      - .:/go/src/hello
    ports:
      - "8080:8080"
    working_dir: /go/src/hello
    command: bee run

Dockerfile

FROM golang:1.10

## Install beego and the bee dev tool
RUN go get github.com/astaxie/beego && go get github.com/beego/bee

app.conf from beego framework

appname = hello
httpport = 8081
runmode = dev

How can I overwrite the httpport(8081) in app.conf using ports(8080) number used in app from docker-compose.yml. After running docker-compose up application runs in port 8081 not in 8080. How can I solve this?

  • 写回答

1条回答 默认 最新

  • donglv5269 2018-12-08 00:30
    关注

    You shouldn't need to update the app.conf to 8080 use the ports to have the docker container listen on 8081 and respond to 8080.

    Change - "8080:8080" to - "8080:8081"

    First port is what the docker container will respond to and the second port is the port of the application within the container.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题