Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker方式启动,但无法访问页面 #30

Open
Phukety opened this issue Nov 10, 2020 · 3 comments
Open

docker方式启动,但无法访问页面 #30

Phukety opened this issue Nov 10, 2020 · 3 comments

Comments

@Phukety
Copy link

Phukety commented Nov 10, 2020

docker方式启后,在容器内部可以通过curl http://localhost:8080 获取响应,但在宿主机无法通过http://localhost:58083 访问(端口可以确定是映射的宿主机的58083端口),求助,谢谢

@zhangsean
Copy link

我发现问题了,项目application.yml文件里面指定了spring.server.address 指定了 127.0.0.1,导致只能监听本地。
把Dockerfile里面把这个配置置空即可容器外部端口映射访问。参考我的Dockerfile:

cp -v /opt/davinci/config/application.yml.example /opt/davinci/config/application.yml \
&& sed -i 's|address:\ 127.0.0.1|address:|' config/application.yml

@Phukety
Copy link
Author

Phukety commented Nov 17, 2020

我发现问题了,项目application.yml文件里面指定了spring.server.address 指定了 127.0.0.1,导致只能监听本地。
把Dockerfile里面把这个配置置空即可容器外部端口映射访问。参考我的Dockerfile:

cp -v /opt/davinci/config/application.yml.example /opt/davinci/config/application.yml \
&& sed -i 's|address:\ 127.0.0.1|address:|' config/application.yml

感谢!,真是这个问题

@zhangsean
Copy link

zhangsean commented Nov 19, 2020

我为Davinci做了docker镜像,zhangsean/davinci,每天监控�davinci版本发布自动构建镜像,有基于alpine和openj9两个jre的版本,一个镜像小,一个内存占用小,大家可以试试。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants