Containerise everything!! : using docker in Ethiopia
You might have come across buzzwords such as containerization, docker and wondered what all the fuss was about. And why it is important to use docker in Ethiopia. Well, This tutorial series is just what you need to join the conversation. We will look through the basics of docker and why it might be useful to your workflow. Not only that by the end of this series you will be able to containerize your applications and get them ready for deployment.
What exactly is Docker?
Docker is a containerization platform that packages your app and all its dependencies together in the form called a docker container to ensure that your application works seamlessly in any environment. This environment might be a production or staging server. Docker pulls the dependencies needed for your application to run from the cloud and configures them automatically. You don’t need to do any extra work. Below are some benefits of Using docker
1. It is cost-effective: It takes fewer resources to run your production application. And an even fewer team of developers to maintain it. The biggest driver of most management decisions when selecting a new product is the return on investment. And docker has proven to be a very efficient option.
2. Standardization & productivity: Docker containers ensure consistency across multiple developments, release cycles and standardizing your environment. One of the biggest advantages of a Docker-based architecture is standardization. Docker provides repeatable development, build, test, and production environments. Standardizing service infrastructure across the entire pipeline allows every team member to work on a production parity environment. By doing this, engineers are more equipped to efficiently analyze and fix bugs within the application. This reduces the amount of time wasted on defects and increases the amount of time available for feature development. Another key use for docker in Ethiopia
3. Compatibility & maintainability: Eliminate the “it works on my machine” problem once and for all. One of the benefits that the entire team will appreciate is parity. Parity, in terms of Docker, means that your images run the same no matter which server or whose laptop they are running on. For your developers, this means less time spent setting up environments, debugging environment-specific issues, and a more portable and easy-to-set-up codebase. Parity also means your production infrastructure will be more reliable and easier to maintain.
4. Rapid Deployment: Docker manages to reduce deployment to seconds. This is because it creates a container for every process and does not boot an OS, unlike virtual machines. Data can be created and destroyed without worry that the cost to bring it up again would be higher than affordable. Also by sharing container reduce dependency install time while using slow network making more use of docker in Ethiopia
5. Continuous Deployment & Testing: If you need to perform an upgrade during a product’s release cycle, you can easily make the necessary changes to Docker containers, test them, and implement the same changes to your existing containers. This sort of flexibility is another key advantage of using Docker. Docker allows you to build, test and release images that can be deployed across multiple servers and cloud services like Kubernetes. Even if a new security patch is available, the process remains the same. You can apply the patch, test it and release it to production.
6. Security: And the last benefit of using docker is — security. From a security point of view, Docker ensures that applications that are running on containers are completely segregated and isolated from each other, granting you complete control over traffic flow and management. No Docker container can look into processes running inside another container. From an architectural point of view, each container gets its own set of resources ranging from processing to network stacks.
Now it’s time to get our hands dirty. The first thing you need to do is install Docker on your own system and to do that just follow the official guidelines here.
After you have done that clone this sample Project locally. It is a simple Nodejs express server that we are going to containerize using docker. Run the following instructions to clone the repo and start it locally
#clone repo
git clone https://gitlab.com/Dagmawi-A/starterproject.git
#cd into project directory
cd starterProject
#install project dependencies
npm install
The next step is going to be to build our docker image and run it. Don’t be intimidated if the terms seem unfamiliar. We will go in-depth in part two of this tutorial.
Run the commands below
#build our docker image
docker build -t <your-name-here>/sampleproject:v1
#run our docker image and expose ports
docker run -p 8000:8000 <your-name-here>/sampleproject:v1
Now that we have got our application running in our Docker container we can access it locally in our browser. Just go to this link.