swag 反向代理自定义docker网络内容器无法通过容器名称转发问题


Recommended Posts

我用的是 linuxserver/swag 这个镜像,主要是想给容器访问添加 https 支持

所有容器都连的自定义网桥网络且固定 ip

1250004394_.png.4238516e9902dca9fc959715c17579fb.png

 

打开swag控制台进入容直接 ping emby 能正常解析到 172.20.1.6

1381902591_.png.fd622296b107bd550e70e7f12c7906e4.png

 

然后 swag 内 nginx 配置使用 emby.subdomain.conf.sample 模板的配置,改名成 emby.subdomain.conf 后重启swag 容器。

816070662_.thumb.png.85aa911ef4a53244c021072b3f746d7d.png

 

奇怪的是当我访问  emby.xxxx.xxx 时,报了 502 Bad Gateway 错误。然后查看nginx 错误日志发现无法解析 emby

647560352_.png.4ed11bc9999b7a821cba972435609bb0.png

 

然而我把 emby.subdomain.conf 内参数 upstream_app 的值从emby 改成  172.20.1.6 时,就可以正常访问。

我想知道为什么 swag 容器在能ping通emby容器名的情况下,内置的nginx却无法解析容器名。拜托大家了!!!

 

Link to comment
On 10/18/2021 at 2:27 PM, Pela said:

smzdm上有一篇文章,大概意思是不支持容器间dns服务,必须指明ip地址,需要自己另外创建docker网络

现在确实是用的 ip 地址来将就用的。。。。。关键的是我另外一个容器 nextcloud 连 mysql 都可以直接用容器名连。。就这个swag 里面的nginx 配置不行。。就很郁闷☹️

Link to comment
  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.