Go imageproxy无法从Docker容器访问。

huangapple go评论91阅读模式
英文:

Go imageproxy inaccessible from docker container

问题

我正在尝试将优秀的Go图像代理服务器https://github.com/willnorris/imageproxy部署在Mac OSX上,作为Docker容器通过Docker Cloud进行部署。

我无法使容器对我的浏览器可访问。

docker run -i -t -p 8080:8080 willnorris/imageproxy:latest /go/bin/imageproxy -addr 0.0.0.0:8080

应该将服务器暴露在docker-machine ip [vmname],在这种情况下是192.168.56.100。

我通过以相同的方式运行一个原始的Express服务器来验证了我的设置。

有人知道这个服务的Docker化有什么问题吗?https://hub.docker.com/r/willnorris/imageproxy/

英文:

I am trying to deploy the excellent Go image proxy server https://github.com/willnorris/imageproxy on Mac OSX as docker container via Docker Cloud.

I cannot make the container accessible to my browser

docker run -i -t -p 8080:8080 willnorris/imageproxy:latest /go/bin/imageproxy -addr 0.0.0.0:8080

should expose the server at docker-machine ip [vmname], in this case 192.168.56.100

I verified my setup by running a vanilla Express server in the same way.

Would anyone know what is up with the dockerization of this service? https://hub.docker.com/r/willnorris/imageproxy/

答案1

得分: 1

从noogen https://github.com/willnorris/imageproxy/issues/57

能够使用'willnorris/imageproxy'版本重现此问题。我可以在容器内部使用curl访问端口8080,但无法从主机访问。

默认配置绑定到127.0.0.1(应该是0.0.0.0),因为这行代码:imageproxy(版本HEAD)监听在localhost:8080

imageproxy docker容器中的localhost(cat /etc/hosts)映射到127.0.0.1

将Dockerfile的第8行更改为:
ENTRYPOINT ["/go/bin/imageproxy", "-addr 0.0.0.0:8080"]

英文:

From noogen https://github.com/willnorris/imageproxy/issues/57

Was able to reproduce this with the 'willnorris/imageproxy' version. I can curl port 8080 inside of the container but not from the host.

The default configuration binds to 127.0.0.1 (should be 0.0.0.0) because of this line: imageproxy (version HEAD) listening on localhost:8080

localhost in the imageproxy docker container (cat /etc/hosts) is map to 127.0.0.1

Change the Dockerfile line 8 to:
ENTRYPOINT ["/go/bin/imageproxy", "-addr 0.0.0.0:8080"]

huangapple
  • 本文由 发表于 2016年3月31日 07:33:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/36321618.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定