从Docker容器共享Unix套接字到ubuntu主机

时间:2018-12-08 16:03:20

标签: ruby-on-rails docker puma

您好,我正在尝试将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

仅在使用卷时发生错误。你可以帮我吗?

0 个答案:

没有答案