When setting up is the concern, nothing is easy especially if the one that you will have to setup is framework filled with codes. Docker is a container that is known to be an application and packed with dependencies which will be running in the host operating system. Docker can run in a variety of infrastructures like Microsoft Windows, Linux distros and Mac OS. The container is packed with runtime, codes, libraries, and system tools that can be easily installed on computers and will run no matter what platform is used.
Docker is now being used to rails development environment. When your rails do not use any container, the tendency would be is that the development may be difficult due to the needed specifications of the platform used. However, if you make your rails application Dockerized, there is a big tendency that the inconsistencies will be eliminated because the application is being packed together with Docker’s dependencies and configurations. Because of this, programmers are having lighter jobs since the tools needed for applications are complete.
What do you need?
In order for you to set up a simple rail development environment with the help of Docker, prerequisites are present which will help you achieve the impossible. The things that you need are of course the Docker toolbox and the docker-sync.
How to setup?
- The first thing that you need to do is make a Dockerfile which will serve as the starting point in the myapp-dev-box- which is empty.
- Then, dependencies will now be installed which will be used for the web application. The dependencies will only run by a sole command because the Docker can easily catch the condition of a container. It is best if you re-run the whole step and you must include the apt-get update which will guarantee that the dependencies are up to date.
- After, you can now make a folder where you can keep the SSH keys and the app. SSH keys should be present since it is the one that will point out the private sources that will be used in the bundle install.
- Then, let the bundle install run.
- Use the Docker toolbox which has the docker-compose that will help in establishing and will be associated with the containers for the app run.
- Once everything is done, you can now use the docker-sync which will sync the bundle and files for a web project. When syncing, always keep in mind that per project synced, it has its own unique ports.
Now, the setup is complete and you are able to create a rail development environment with the help of Docker.
If you want your rails applications run on different platforms or even be free from inconsistencies, using the Docker is the best option. It is the best option that you can find if you are up for a simple rail development environment since the setup is not difficult and can be done easily if you have the proper tools needed.