Use docker for day to day development with Rails


I am a Ruby/Rails developer. In order to develop on different projects and with different Ruby versions, I use Docker. I run some commands very, very frequently. I need to do it fast and to have a fast execution time. Without Docker, I like to use Spring because I save a few seconds each time (8 to 20 seconds on my current project). I found a way to still use it with Docker, I run a bash session, with docker-compose run web bash, and I run my command inside. It works but there is a few drawbacks. I have to have a Tmux panel opened continuously. It does not work with some vim plugins when I need to execute a command and get the result.

I can exec command on a runner container by doing docker exec -it <container_name> bin/rspec. It works but it shutdown spring each time.

I can also install all my favorite tools (vim, tmux, zsh, etc.) inside my development containers but I don’t think it’s a good practice.

I’m looking for a solution as similar as possible than running command inside my local machine. I think it’s possible to create a shortcut like de my_command, for docker exec.

Do you have solution? Do you have the same problems? Is it a good practice to use docker for a day to day development ?


1 Like

I tried, and ultimately gave up on using docker for my day-to-day development. This issues you are having were ultimately too cumbersome for me - shelling in, running console, running rspec, getting guard to work.

Which is a shame really, because I really like the idea of actually developing in an environment so similar to my deployment.