dtvpl739577 2017-10-24 12:33
浏览 277
已采纳

无法在Docker上运行Golang应用程序

I am trying to run this project - https://github.com/JumboInteractiveLimited/codetest

I've downloaded the Docker tool box, and I've executed the build and run commands as mentioned on the GitHub page, but when I try to access http:localhost:8080, the page is still unavailable.

When I try to execute run again, Docker says

"$ ./run.sh
Listening on http://localhost:8080
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon:    driver failed programming external connectivity on endpoint quirky_mcnulty (32af4359629669ee515cbc07d8bbe14cca3237979f37262882fb0288f5d6b6b8): Bind for 0.0.0.0:8080 failed: port is already allocated."

Edit: To clarify, I get that error only when I run the 2nd time. When I ran the run command first, it didn't complain. I ran it another time just to confirm that it's running.

When I initially ran, I got the following:

$ ./run.sh
Listening on http://localhost:8080
2017/10/24 13:51:53 Waiting...
  • 写回答

2条回答 默认 最新

  • dsgnze6572 2017-10-24 13:07
    关注

    Change run.sh to replace port 8080 to 8082

    #!/bin/bash
    echo "Listening on http://localhost:8082"
    docker run -p 8082:80 codetest
    

    I have changes port to 8082 if the port is already in use change that port again to some other port based on your available port.

    If you are on Windows

    netsh interface portproxy add v4tov4 listenport=8082 listenaddress=localhost connectport=8082 connectaddress=192.168.99.100(IP of the Docker)
    

    Here is the helping discussion on port farwarding in windows with docker Solution for Windows hosts

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥15 如何修改pca中的feature函数
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况