Solargraph + Docker unable to bind to a different interface

Viewed 531

I'm using solargraph server within a docker container. When the solargraph server is started with:

solargraph server

The server automatically binds to the 127.0.0.1 interface. This interface isn't accessible outside the docker container and prevents my IDE running on my host from talking to solargraph and getting the details it needs for autocompletion.

Does anyone know if it is possible to force the solargraph server to bind to a different interface? I seem to be able to change the port (with -p), just not the interface.

Output from solargraph:

root@ec55f4209be3:/app# solargraph server
[2018-09-18 12:00:25] INFO  WEBrick 1.3.1
[2018-09-18 12:00:25] INFO  ruby 2.3.5 (2017-09-14) [x86_64-linux]
== Sinatra (v1.4.8) has taken the stage on 7657 for development with backup 
from WEBrick
[2018-09-18 12:00:25] INFO  WEBrick::HTTPServer#start: pid=49 port=7657
127.0.0.1 - - [18/Sep/2018:12:01:16 UTC] "GET / HTTP/1.1" 404 512

Currently can access it only from inside the container by doing:

wget http://localhost:7657

Update:

I recently discovered one of my libraries was holding back installing the latest version of solargraph. I updated to the latest version which comes with a host option when running the server.

example:

solargraph socket --host=0.0.0.0 --port=5001

While this should work I still cant access solargraph server application.

1 Answers

The full definition of the publish flag for docker run actually includes the hostname . E.g.

docker run -p 127.0.0.1:80:8080/tcp ubuntu bash
Related