[UPDATE]
Unfortunately, dear colleagues, I gave up on docker for now. Main factors:
- Poor shared volume performance (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!
- 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.
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.
[OLD POST]
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.
There are a few questions, I was hoping our community may help to solve.
The goal - everything works 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)
Requirements
- 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.
- 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
GEM_PATH
,bundler
in each container will install gems there. Applicationbundler
should take care of loading the right versions. - I should be able to debug code easily - putting breakpoints and interacting with debugger as it would be running locally
- It should support TDD cycle - I change file, it's caught by
guard
process in the container and related tests are executed - 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).
Questions
- 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?
- 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
guard
, easier debugging, launching arbitrary processes in the same run) - 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
docker-compose.yml
(volumes) or defined inside a different docker file that inherits from the base one ?
Other thoughts
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 http://wercker.com), 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.
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.