问题
Hello I am trying to share a unix socket from my docker container rails app to my ubuntu host in order to connect puma server with nginx reverse proxy.
In my docker-compose file I have:
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
I am getting this error on web service when loading with volumes:
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>'
I am expecting this behavior:
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
Error only occurs when I use volumes. can you give me a hand?
来源:https://stackoverflow.com/questions/53684311/share-unix-socket-from-docker-container-to-ubuntu-host