Using a dedicated proxy container in front of Rails app container

I’m in the process of dockerizing a Rails app before deploying it to production.

I was able to create a 2 container (db+app) system and now I’m trying to add a proxy container (with Nginx) to run in front of the app to serve static assets.

  • Changing tomcat port in Dockerfile
  • Deploy to JBoss from Docker Jenkins Container
  • Docker and Rails environments
  • mysql_upgrade failed - innodb tables doesn't exist?
  • Unable to run mongod inside ubuntu docker container through ssh (Docker is started using “--net=host”)
  • Docker expose not working
  • I have created a basic container starting from nginx:1.11-alpine with the config below

    server {
      listen *:80;
      location / {
        proxy_pass http://app:3000;

    I’m now able to point my browser to and get the root page, however, static assets are (obviously) not served and I don’t know how to proceed.

    Should I copy the static assets from the app container to the proxy container?

    How should I update the Nginx config file?

    My docker-compose.yml looks like

    version: '2'
        driver: local
        build: .
        command: bin/rails server -b
          - 3000:3000
          - postgres:db
          - postgres
        image: nginx:1.11-alpine
          - ./default.conf:/etc/nginx/conf.d/default.conf
        command: nginx -g 'daemon off;'
          - 80:80
          - 443:443
          - app
          - app


  • Pass “volume-driver” option to kubernetes pod
  • haproxy in docker container
  • Types of errors docker in Windows?
  • How to re-mount a docker volume without overriding existing files?
  • unable to access mailpile server inside docker container
  • curl from docker ubuntu image
  • One Solution collect form web for “Using a dedicated proxy container in front of Rails app container”

    One option might be to share assets directory from app container to nginx container through shared volume mount and configure nginx to serve those files.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.