无法在Docker上运行Golang应用程序 [英] Unable to run Golang application on Docker
问题描述
我正在尝试运行此项目 - https://github.com/JumboInteractiveLimited/codetest
我已经下载了Docker工具箱,并且执行了GitHub页面上提到的构建和运行命令,但是当我尝试访问http:localhost :8080,页面仍然不可用。
当我尝试再次执行运行时,Docker说:
$ ./run.sh
听取http:// localhost:8080
C:\程序文件\停顿工具箱\docker.exe:错误响应从守护进程:驱动程序无法编程端点上的外部连接quirky_mcnulty(32af4359629669ee515cbc07d8bbe14cca3237979f37262882fb0288f5d6b6b8):绑定0.0.0.0:8080失败:端口已分配。
编辑 只有当我第二次跑完这个错误。当我第一次运行run命令时,它没有抱怨。
当我最初跑步时,我得到了以下结果:
$ ./run.sh
听取http:// localhost:8080
2017/10/24 13:51:53正在等待...
更改run.sh以将端口8080替换为8082
#!/ bin / bash
echo监听http:// localhost:8082
docker run - p 8082:80 codetest
如果端口已在使用中,将端口更改为8082更改该端口根据您的可用端口再次连接到其他端口。
如果您在Windows上
netsh interface portproxy add v4tov4 listenport = 8082 listenaddress = localhost connectport = 8082 connectaddress = 192.168.99.100(Docker的IP)
以下是有关docker 适用于Windows主机的解决方案
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...
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
这篇关于无法在Docker上运行Golang应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!