Docker, Rspec and Guard

Docker has been a blessing for development, especially when I want to maintain a consistent environment for each client, I want to be able to back up those environments easily, and transport them to wherever I want to.

It's been nice being able to have those development environments containerized and not having to have all of the dependencies loaded on my personal machine.

For a while I've been trying to use Guard with rspec so that I can have even more rapid feedback in my development cycle. While I've used this successfully on my Mac, I didn't have a lot of time to figure out how to get it working inside docker.

While trying to figure it out today for a little while, I came across a page on the guard wiki that helped. It said to use this command: guard

  echo fs.inotify.max_user_watches=524288 | \
  sudo tee -a /etc/sysctl.conf && sudo sysctl -p

and while that didn't work in the container itself, the secret sauce to getting it to work inside a docker container was to check on the host. My max_user_watches on the host was something extremely low, and when I updated the max_user_watches, I didn't even need to restart the container to have guard work.

Share this post