docker - Docker 服务运行但未绑定到主机端口给出 503 Service Unavailable
问题描述
Docker 服务应该绑定到 2007 端口。
root@docker:~# docker service ls | grep 2007
hn7ljux4l6ib access_agency_overview-feature replicated 1/1 docker-repo.com/access_agency_overview:feature *:2007->80/tcp
还要检查docker inspect
端口是否已发布。看起来很棒
root@docker:~# docker service inspect hn7ljux4l6ib | grep Port
"Ports": [
"TargetPort": 80,
"PublishedPort": 2007,
"Ports": [
"TargetPort": 80,
"PublishedPort": 2007,
"Ports": [
"TargetPort": 80,
"PublishedPort": 2007,
看起来也很棒docker logs
root@docker:~# docker logs 047166727d33
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
但netstat -tulnp | grep 2007
没有输出。
以及卷曲到本地主机
root@docker:~# curl http://localhost:2007
curl: (7) Failed to connect to localhost port 2007: Connection refused
附言。2007 允许在防火墙上
编辑添加结果来自docker ps
047166727d33 docker-repo.com/access_agency_overview:feature "/docker-entrypoint.…" 24 minutes ago Up 24 minutes 80/tcp access_agency_overview-feature.1.ucti38zri157sc8014y0f3cjq
解决方案
推荐阅读
- php - 触发inotify事件时如何运行php代码
- javascript - React 如何渲染数组元素一次?
- python - Python多处理的字符串问题
- html - 似乎无法让我的字体与我的项目作为 CSS 链接起来很棒
- android - 尝试使用 onclick 在回收视图中打开另一个活动
- azure - 如何从特定的 git pull 请求下载文件?
- elvis-operator - 我无法在 Kotlin 中使用 elvis 运算符
- python - 验证控制台应用程序中是否存在 GUI 元素
- python - Python Requests Firebase - 如何查找所有 firebase json 文件名?
- flutter - 如何在颤动中制作可滚动的屏幕?