Usually work starts from preparation of working environment. It can be either PC or a laptop with set of your favourite programs for work. But imagine that, for instance, you joined a new company or your computer was broken, and you need to continue working as soon as possible. It might be convenient to have a copy of virtual machine that could be transferred between physical computers, but in this case some overheads for running and maintenance ( including backups ) of guest OS inside of virtual machine would be inevitable.
In my humble opinion, Docker containers solve all these problems successfully. Briefly, Docker is a system of pseudo-virtualization based on containers, buult on the top of Linux cgroups feature. In terms of Docker container is built around the main process you want to run in its own isolated environment. All steps which describe preparations of this environment are saved in a file named Dockerfile. Of course, this is very approximate and rough imagination about Dockerfile and it has many other important features, but for our first task such description is enough.
Therefore, we get a lighweight container image as the output, which can be easily saved to portable Flash drive, or to the cloud storage, for example. Backup procedure for container is much simpler - actually, having of Dockerfile and access to required repositories are enough to reproduce the image. Overhead for running container is much less in comparison to "honest" virtualization.
We will use a simple shell-based wrapper as main executable inside container, as we do not need this main server itself indeed, but we need its environment with necessary software installed that we are going to use in a further work. Let's look at list of the software:
Also let us mount directory /home/username/work of the host machine into /home/syseng location of container. Below is the full code of Dockerfile: Gemfile and requirements.txt are pretty simple and just describe lists of packages have to be installed:
Then, user "docker build" command we have to create the container image. It supports a lot of variants of execution, we will use the simplest one as we consider that at the moment we do not have any auxiliary infrastructure. ( But only at the moment :) )