Hi Everyone, Hope you all Programming geeks are doing well. In today's modern Software Industry, there are two types of engineers:
1. Product Engineers : A modern fancy word for a full stack developer who develops a software product features from users point of view.
2. 10X Engineers : A modern fancy word for a smart and efficient coder. (According to me, 10x Engineer is a hype) . Trust me !! You don't want to put that tag in your cv. Only god knows the exact definition of a 10x engineer. But this post is not about 10X Engineers ! this post is about 2 friendly tools (according to me) that every developer should know:
Git and Docker. Disclaimer: (i am not a 10x engineer, just a guy who likes to develop software [ quick and easy ]). Lets look at them one by one.
Docker is an OS level service container for software. It is very easy to learn and understand and is widely used in the deployment stage of the software development lifecycle.
Suppose you develop a software on your machine with a certain tech stack. Now, you want to deploy the software onto someone else’s machine. In such a case, you only have 2 options:
1. You download the OS and all the app dependencies (make the entire deployment machine a replica of your development machine) and then deploy the software .
Or
2. You can use docker and run the software in docker container. It is independent of the deployment machine. [ The entire deployment process can be done in 1–2 lines of code ]
Let’s look at some of the basic concepts of docker.
Installing Docker on Ubuntu : Sudo apt install docker.io
Check version of docker : docker --version
Check basic docker container & image installed: docker ps -a / docker info
Download Image from dockerhub : docker pull <image_name>
Example : docker pull ubuntu:18.04 . This will download an ubuntu image.
Check number of images information : docker images
Run Docker image: docker run -it <image_id>
Remove an image with id : docker rmi <image_id>
Remove all the unnecessary resource/containers : docker system prune
A docker file is a simple txt file which has instructions to build image [Automation of image creation for our app ]
FROM : This command is used to get the base image from the docker hub.
Example: FROM ubuntu:14.04
RUN : This command is used to run command during the build of docker image.
Example: RUN apt-get update
CMD : This command is executed after the build of our image.
Example: CMD [“echo”, “CMD will execute after the docker build command”]
COPY : This command is used to copy files from local machine to the apps docker container.
Example: COPY /myfile /Docker_Dir.
docker build <docker_file> -t <image_name:tagname>
docker run <image_id>
// Simple dockerfile example ..
FROM ubuntu:18.04
RUN apt-get update
CMD ["python", "print'hello from pyhton'"]
Docker compose is used for developing multi container docker applications. Docker-Compose file is a yml file. Simplest example would be to expose the ports of server or exposing databases along with installing databases and attaching volumes to the container etc…
It is very important as it combined with dockerfile will automate the entire deployment of the app.
Docker volumes are used to decouple containers from the data /storage . Since we always want to store the data (data is the new oil) associated with the app, docker volumes are very useful for creating an application at an enterprise level.
GitHub is a platform that help people develop software together. In simple terms, the entire software team (tech + non-tech) can work on the same project at same time and can contribute and can track individual performance /code.
It can also be used as version control for software etc. Git on the other hand is a command line tool that is used by developers to perform above tasks like code version/creating and uploading and maintaining repository etc… let’s look at few git commands.
git clone : cloning a repository from GitHub ( a folder stored in the cloud ) to your own computer.
git add : make a change or add new file or anything to the current repository.
git commit : when you are completely sure of the change in code or addition of code. Do commit to the repository with a one line message .
git push : pushing the change to the repository on cloud to make it available for everyone to see the changes.
git pull : git pull is used to pull the changes and get the updated current repository on your computer.
git branch : git branch is used to create a new branch where an individual developer can write/add code on a completely separate branch and if everything works fine can be later merge with the existing codebase.
git merge : git merge is used to merge the code written by multiple developers into a single main codebase.
That’s it for this post. I hope you liked it. Thank you for taking your time and reading my post.
Stay happy, sleep well, don't try to be a 10x Engineer and keep coding.