rubydockerjrubydocker-composecuba

How to bind the docker container and the cuba process through localhost:9292 in Ubuntu 14


I'm on ubuntu 14.04 and I have a super simple Cuba App which seems to be lacking something:

Gemfile:

source "https://rubygems.org"
gem 'cuba'

config.ru

require "./hello_world"
run Cuba

docker-compose.yml

web:
  build: .
  volumes:
    - .:/myapp
  ports:
    - "9292:9292"
  command: bundle exec rackup -p 9292

Dockerfile

FROM jruby:1.7.19

RUN mkdir /myapp
WORKDIR /myapp
ADD . /myapp

RUN bundle install

I've tryed to run it through the docker-compose up. Which builds the image and binds me the cuba process in the terminal. I can see the server listening to the port 9292. But I'm totally unable to access it through the localhost:9292 url.


Solution

  • Seems like by default the host is not binded to the docker daemon ip. Changing the docker-compose.yml and adding the rackup option fixed it.

    web:
      build: .
      volumes:
        - .:/myapp
      ports:
        - "9292:9292"
      command: bundle exec rackup -o 0.0.0.0