Docker as the effective Rails development environment Docker as the effective Rails development environment docker docker

Docker as the effective Rails development environment


Consider orats (opinionated rails application templates):

The goal is to provide you an excellent base application that you can use on your next Rails project.

And:

It also happens to use Docker so that your app can be ran on any major platform -- even without needing Ruby installed.


To some of your other requirements:

  • my keys ... I should be able to reuse the ones that are on my host machine

    Specify keys in your docker-compose.yml but omit the value.

  • putting breakpoints and interacting with debugger

    When starting a service, instead of docker-compose up, use docker-compose run --service-ports. This will allow e.g. binding.pry to work.

  • When executing Cucumber/Selenium tests I should be able to see what's happening in the browsers.

    This is tricky. For a workaround consider using save_screenshot, and (the important part) save it to a directory which is mounted to a volume on the Docker host. Open that directory on the host and you'll be able to see an updating screenshot.


some notes about usage docker for development:

  • run bash command inside docker and to work as in VM, link
  • map port of container with host machine and use browser link
  • map files link
  • .env technique of setting variables allows usage of docker in any environment including CI link
  • bash scripts and container naming can help to automate tasks link