title: Docker as the effective Rails development environment
body: <h2>[<strong>UPDATE</strong>]</h2>
  
  <p>Unfortunately, dear colleagues, I gave up on docker for now. 
  Main factors:</p>
  
  <ul>
  <li>Poor <a href="https://forums.docker.com/t/file-access-in-mounted-volumes-extremely-slow-cpu-bound/8076" rel="nofollow noreferrer">shared volume performance</a> (there are some workarounds using additional tools, but it seems more of a hack). This is not an issue for those fine folks that use Linux, though!</li>
  <li>I have underrated some upfront work, which is required to make remote runtimes play nicely with editors/IDEs. Things like linting assume a local runtime out of the box and it seems the most widespread solution is a myriad of bash wrapper scripts to delegate execution to a docker container.</li>
  </ul>
  
  <p>Also we hired two DevOps guys, who have quite a bit of docker experience, if they will come up, how to (painlessly!) introduce docker in our company for both hosting and development, I will be happy to revise this topic.</p>
  
  <hr>
  
  <p>[<strong>OLD POST</strong>]</p>
  
  <p>As a new version utilising native OSX hypervisor is now available, I've decided to try pushing all my Ruby/Rails/JS development to the docker containers. I've played quite a bit on a fresh El Capitan installation, by trying to dockerize a few private gems we have and our monolith Rails application.</p>
  
  <p>There are a few questions, I was hoping our community may help to solve.</p>
  
  <p><strong>The goal</strong> - <em>everything works</em> and host has only iTerm, git, Sublime, SourceTree and Docker installed (nothing is carved in stone, if some additional dependency(-ies) may improve/make the workflow significantly easier, I will be happy to review the options)</p>
  
  <p><strong>Requirements</strong></p>
  
  <ul>
  <li>There are quite a few services (EngineYard, ElastiBeanstalk, Github etc) that require my keys to function correctly, I should be able to reuse the ones that are on my host machine.</li>
  <li>Reusing installed RubyGems across all Ruby app containers would be nice. Basically docker container/docker-compose file is setup in a way that it mounts the same directory that will be a <code>GEM_PATH</code>, <code>bundler</code> in each container will install gems there. Application <code>bundler</code> should take care of loading the right versions.</li>
  <li>I should be able to debug code easily - putting breakpoints and interacting with debugger as it would be running locally</li>
  <li>It should support TDD cycle - I change file, it's caught by <code>guard</code> process in the container and related tests are executed</li>
  <li>When executing Cucumber/Selenium tests I should be able to see what's happening in the browsers. (As I understand the options are - connecting through VNC to virtual frame buffer or running X server locally. I'd prefer options that involve less dependencies on the host side).</li>
  </ul>
  
  <p><strong>Questions</strong></p>
  
  <ul>
  <li>Dockerizing existing apps is relatively easy these days, how do you, good people, handle creation/bootstrapping new projects? Common dev container that has usual dependencies?</li>
  <li>Is it possible to setup the things the way that container "keeps running" more or less like a VM? (This may solve lots of my requirements - running <code>guard</code>, easier debugging, launching arbitrary processes in the same run)</li>
  <li>I intend to use docker to pack our application for CI purposes. This means that for different environments, there might be a slightly different dependencies, also mounted volumes will differ (probably container for CI won't have those). Should it be solved as different config in <code>docker-compose.yml</code> (volumes) or defined inside a different docker file that inherits from the base one ?</li>
  </ul>
  
  <p><strong>Other thoughts</strong></p>
  
  <p>I am also fine trying out commercial or none-commercial tool, that wraps/bundles the described tooling. So far I've found a thing called <a href="http://wercker.com" rel="nofollow noreferrer">http://wercker.com</a>), the thing I don't like about it, it seems like it requires you to setup dev env anyways, which kill the purpose of the whole endeavour.</p>
  
  <p>Feel free to down vote this question if it was posted before and answered clearly. On the other hand I would be happy if this thread will produce guides, links, suggestions to get it done smoothly, I am pretty sure this interests quite a few devs these days.</p>