As a Ruby and Rails developer, I’ve always wanted to have a working and isolated environment for my projects, regardless if it’s a client project, some gem that I work on, or a pet project. Back in the day, I had always wanted to achieve this using Vagrant. However, whenever I tried to do it, I always ended up spending a couple of hours on Stack Overflow before giving up.
And even if your middle name is “perseverance” and you manage to get a working bootstrapped environment, often there are problems with system libraries or slight differences in the system environments which can cause problems.
In this article, we are going to build a Docker image with a working Ruby environment and deploy a Ruby application to a container. By using Docker, we will ensure that the environment will always be the same, and it will be easy to reproduce.
One thing to note — we will not cover Docker installation. If you do not have Docker installed, you can head over to the Docker documentation and install it.