Docker compose connection issue

I try to run a rails application in docker but I have an issue with docker-compose network, I think…

My Dockerfile looks like this:

  • Docker-Compose: how to mapping volume from host into container?
  • How can I connect snort and snorby in docker environment?
  • Storing local docker images on External HDD boot2docker
  • Unable to get Maven version from /usr/share/maven/bin/mvn Could not find system variable
  • Discourse forum output
  • Docker - SpringConfig - Connection refused to ConfigServer
  • FROM ruby:2.3-slim
    
    RUN apt-get update \
     && apt-get install -qq -y --no-install-recommends \
        build-essential \
        nodejs \
        libpq-dev \
        git \
        tzdata \
        libxml2-dev \
        libxslt-dev \
        ssh \
     && rm -rf /var/lib/apt/lists/*
    
    ENV APP_HOME /var/apps/books-store
    RUN mkdir -p $APP_HOME
    WORKDIR $APP_HOME
    
    ENV GEM_HOME /var/apps/books-store/vendor/bundle
    ENV PATH $GEM_HOME/bin:$PATH
    ENV BUNDLE_PATH $GEM_HOME
    ENV BUNDLE_BIN $BUNDLE_PATH/bin
    
    EXPOSE 3000
    

    my docker-compose.yml looks like this:

    version: '2'
    services:
      database:
        image: postgres
        volumes:
          - ./data/pgdata:/pgdata
        ports:
          - '5555:5432'
        env_file:
          - '.env'
      web:
        links:
          - database
        build: .
        volumes:
          - .:/var/apps/books-store
        ports:
          - '3000:3000'
        command: [bundle, exec, puma]
        env_file:
          - '.env'
        stdin_open: true
        tty: true
    

    When I try docker-compose up, from logs I see rails server starts successfully but when I try to access localhost:3000 from host browser it does not work and I could not understand why. What am I doing wrong?

    docker ps:

    407b59a2fa99   bookstore_web   "bundle exec puma"      About a minute ago  Up 41 seconds  0.0.0.0:3000->3000/tcp  bookstore_web
    1837fc3e3f387  postgres        "docker-entrypoint..."  About a minute ago  Up 49 seconds  0.0.0.0:5555->5432/tcp  bookstore_database_1
    

    docker-compose logs web:

    Attaching to bookstore_web_1
    web_1 | Puma starting in single mode...
    web_1 | * Version 3.6.2 (ruby 2.3.3-p222), codename: Sleepy Sunday Serenity
    web_1 | * Min threads: 0, max threads: 16
    web_1 | * Environment: development
    web_1 | * Listening on tcp://0.0.0.0:9292
    web_1 | Use Ctrl-C to stop
    

  • Docker set read timeout for push
  • Viewing startup logs of docker
  • Issues when trying to run Envoy front-proxy example
  • Dynamically assigns different value for the environment variable upon a Docker service scale
  • Nginx SSL inside a docker container
  • Unable to start embedded container due to NoClassDefFoundError
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.