title: When modifying a Rails app on Docker, how get source code changes to load?
body: <p>When running a Rails app on a development machine, using Docker, how does once force code changes to be used?</p>
  
  <p>I'm using Docker to test out / tweak a Rails app (Helpy), but when I modify the Rails source any changes just get ignored. Even changes to dockker/run.sh or tweaking text on a view.</p>
  
  <p>So docker is apparently caching everything, how to I tell docker to use the current source code that I have edited?</p>
  
  <p>I tried </p>
  
  <pre><code>docker-compose down (then up)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>docker-compose restart
  </code></pre>
  
  <p>or</p>
  
  <pre><code>docker-compose build
  </code></pre>
  
  <p>The Dockerfile is </p>
  
  <pre><code>FROM ruby:2.4
  
  ENV HELPY_VERSION=master \
      RAILS_ENV=production \
      HELPY_HOME=/helpy \
      HELPY_USER=helpyuser \
      HELPY_SLACK_INTEGRATION_ENABLED=true
  
  RUN apt-get update \
    &amp;&amp; apt-get upgrade -y \
    &amp;&amp; apt-get install -y nodejs postgresql-client imagemagick --no-install-recommends \
    &amp;&amp; rm -rf /var/lib/apt/lists/* \
    &amp;&amp; useradd --no-create-home $HELPY_USER \
    &amp;&amp; mkdir -p $HELPY_HOME \
    &amp;&amp; chown -R $HELPY_USER:$HELPY_USER $HELPY_HOME /usr/local/lib/ruby /usr/local/bundle
  
  WORKDIR $HELPY_HOME
  
  USER $HELPY_USER
  
  RUN git clone --branch $HELPY_VERSION --depth=1 https://github.com/helpyio/helpy.git .
  
  # add the slack integration gem to the Gemfile if the HELPY_SLACK_INTEGRATION_ENABLED is true
  # use `test` for sh compatibility, also use only one `=`. also for sh compatibility
  RUN test "$HELPY_SLACK_INTEGRATION_ENABLED" = "true" &amp;&amp; sed -i '128i\gem "helpy_slack", git: "https://github.com/helpyio/helpy_slack.git", branch: "master"' $HELPY_HOME/Gemfile
  
  RUN bundle install
  
  RUN touch /helpy/log/production.log &amp;&amp; chmod 0664 /helpy/log/production.log
  
  # Due to a weird issue with one of the gems, execute this permissions change:
  RUN chmod +r /usr/local/bundle/gems/griddler-mandrill-1.1.3/lib/griddler/mandrill/adapter.rb
  
  # manually create the /helpy/public/assets folder and give the helpy user rights to it
  # this ensures that helpy can write precompiled assets to it
  RUN mkdir -p $HELPY_HOME/public/assets &amp;&amp; chown $HELPY_USER $HELPY_HOME/public/assets
  
  VOLUME $HELPY_HOME/public
  
  COPY docker/database.yml $HELPY_HOME/config/database.yml
  COPY docker/run.sh $HELPY_HOME/run.sh
  
  CMD ["./run.sh"]
  </code></pre>
  
  <p>And the docker-compose.yml is</p>
  
  <pre><code>version: '2'
  
  services:
    frontend:
      image: webwurst/caddy
      volumes:
        - ./docker/Caddyfile:/etc/caddy/Caddyfile
        - ./certs:/etc/caddy/certs
      volumes_from:
        - helpy:ro
      ports:
        - "80:80"
        - "443:443"
      networks:
        - front
      restart: always
      depends_on:
        - helpy
    helpy:
      image: helpy/helpy
      restart: always
      networks:
        - front
        - back
      volumes:
        - rails-assets:/helpy/public
      env_file: docker/.env
      #environment:
      #  - DO_NOT_PREPARE=true
      depends_on:
        - postgres
    postgres:
      image: postgres:9.4
      restart: always
      networks:
        - back
      env_file: docker/.env
      volumes:
        - ./postgres:/var/lib/postgresql/data
  
  volumes:
    rails-assets:
      driver: local
  
  networks:
    front:
      driver: bridge
    back:
      driver: bridge
  </code></pre>
  
  <p>In docker-compose.yml I changed</p>
  
  <pre><code>  helpy:
      image: helpy/helpy
  </code></pre>
  
  <p>to </p>
  
  <pre><code>  helpy:
      build: .
  </code></pre>
  
  <p>expecting that to stop using the pre-built docker image, and use the code on the development machine. But any changes I make to a view (for example just changing some heading text on a view from "Admin Brand" to "My New Header") get ignored. I tried</p>
  
  <pre><code>docker-compose down
  docker-compose up
  </code></pre>
  
  <p>Similarly I tried docker-compose build or docker-compose restart</p>
  
  <p>So Docker is apparently caching the source, not using the "live" version of the source that I edit.</p>
  
  <p>I've used Vagrant quite a lot but am very new to Docker so any help on modifying a Docker project to allow local development changes would be appreciated.</p>