Say Goodbye to “It Works on My Machine” — Introducing Docker

Samuel Nainggolan
3 min readMar 14, 2022

Have you ever experienced the “it works on my machine” problem when delivering your software? If your answers is yes, then Docker is the solution!

Docker — A containerization platform

Through decades people try to find the best way to deploy an application to a server. In early 2000s, application mostly works in “monolithic” architecture and doesn’t prepared for a big amount of concurrent app usage. In that case, application deployment was done bare metal — by directly installing the app in the OS level. As time goes by, VM based deployment was introduced to bring portability for app deployment. VM based deployment is better than bare metal in terms of portability, but it still has some problems in term of provisioning time and some useless disk space used to store the OS files. Then containerization technique was introduced as an improvement to the VM method. Containerization works similarly as VM method, but instead of installing all the OS into the platform, container only contains the core features needed to run the app. This mechanism makes a container become very light in term of system resources usage and can be easily provisioned or disposed.

Bare Metal vs VM vs Container

One of the mostly used containerization platform is Docker, which can be orchestrated later using Docker Swarm or Kubernetes.

Docker for Spring Boot App Deployment

For running the Sikepa backend service, we are hosting it with Google Cloud Platform virtual machines running Docker inside it. The overall CI/CD process will be discussed in another blog post, but the app deployment process is involving Docker as the containerization platform used to run the application.

Docker deployment usually requires a Dockerfile as a container definition file. But in Spring Boot, the build tools (Maven or Gradle) has provided a task “bootBuildImage” to build a Docker image based on a Spring Boot app.

Command used to generate Docker image with Gradle

With this task, we don’t need to make Dockerfile definition to build our Docker image. After the image has been built, then we publish the image to GCP container registry. This overall process helps team to have a fast and reliable deployment scheme from Gitlab to GCP VM.

Solve The “It Works on My Machine” Problem

Another problem that can be solved in Sikepa development by using Docker is the It Works on My Machine problem.

This kind of problem makes development feel harder because we are not focusing on developing features, instead team are disturbed by debugging runtime application errors caused by environment difference.

To solve this problem, we defined the used external services like databases into a Docker Compose file.

By using Docker Compose, all team members can run the exact same version of services . To run these services, just type docker-compose up -d in the terminal and the database instance will run in seconds.

Overall, Docker is very useful in Sikepa development process. It makes all application deployment process standardized and easier to mantain.

Thank you for reading this blog and see you in another PPL blog series!

--

--