ruby-on-rails - 从 docker 容器共享 unix 套接字到 ubuntu 主机
问题描述
您好,我正在尝试从我的 docker 容器 rails 应用程序共享一个 unix 套接字到我的 ubuntu 主机,以便将 puma 服务器与 nginx 反向代理连接。
在我的 docker-compose 文件中,我有:
version: '3.2'
services:
web:
command: puma -b 'unix:///var/run/puma.sock?umask=0777'
ports:
- '3000:3000'
volumes:
- /var/run/puma.sock:/var/run/puma.sock:rw
加载卷时,我在 Web 服务上收到此错误:
web_1 | * Listening on unix:///var/run/puma.sock?umask=0777
web_1 | /usr/local/bundle/gems/puma-3.9.1/lib/puma/binder.rb:359:in `unlink': Is a directory @ unlink_internal - /var/run/puma.sock (Errno::EISDIR)
web_1 | from /usr/local/bundle/gems/puma-3.9.1/lib/puma/binder.rb:359:in `rescue in add_unix_listener'
web_1 | from /usr/local/bundle/gems/puma-3.9.1/lib/puma/binder.rb:356:in `add_unix_listener'
web_1 | from /usr/local/bundle/gems/puma-3.9.1/lib/puma/binder.rb:141:in `block in parse'
web_1 | from /usr/local/bundle/gems/puma-3.9.1/lib/puma/binder.rb:88:in `each'
web_1 | from /usr/local/bundle/gems/puma-3.9.1/lib/puma/binder.rb:88:in `parse'
web_1 | from /usr/local/bundle/gems/puma-3.9.1/lib/puma/runner.rb:144:in `load_and_bind'
web_1 | from /usr/local/bundle/gems/puma-3.9.1/lib/puma/single.rb:87:in `run'
web_1 | from /usr/local/bundle/gems/puma-3.9.1/lib/puma/launcher.rb:174:in `run'
web_1 | from /usr/local/bundle/gems/puma-3.9.1/lib/puma/cli.rb:77:in `run'
web_1 | from /usr/local/bundle/gems/puma-3.9.1/bin/puma:10:in `<top (required)>'
web_1 | from /usr/local/bundle/bin/puma:23:in `load'
web_1 | from /usr/local/bundle/bin/puma:23:in `<main>'
我期待这种行为:
web_1 | Puma starting in single mode...
web_1 | * Version 3.9.1 (ruby 2.3.7-p456), codename: Private Caller
web_1 | * Min threads: 5, max threads: 5
web_1 | * Environment: production
web_1 | I, [2018-12-08T15:10:17.371560 #1] INFO -- sentry: ** [Raven] Raven 2.7.4 ready to catch errors
web_1 | I, [2018-12-08T15:10:17.686838 #1] INFO -- : Raven 2.7.4 ready to catch errors
web_1 | * Listening on unix:///var/run/puma.sock?umask=0777
web_1 | Use Ctrl-C to stop
仅当我使用卷时才会出现错误。你能帮我个忙吗?
解决方案
推荐阅读
- reactjs - 为什么 React 不渲染我的组件数组?
- pine-script - Tradingview Pine 脚本 - 自定义指标的顶部/底部填充/间距?
- stata - 我想根据 stata 中的条件向我的数据集添加新行
- javascript - 如何为捆绑的反应项目加载外部文件?
- cefsharp - 如何拦截无方案的链接请求?
- python - 如何迭代带有元组的列表并将 nltk.FreqDist 用于整个结构
- c - 以前的声明和冲突的类型
- django - 无法将关键字“文章”解析为字段。选择有: 选择有:作者、标题、ID 等
- javascript - React react-html-parser 如何将html元素转换为字符串
- android - zxing.net.mobile 可以读取 xamarin android 中的小条形码吗?