Docker is a platform for building, running, and shipping applications in a consistent manner, so if your application works on your development machine, it can work and function in the same way on other machines.
Live demo: https://hub.docker.com/repository/docker/mistervaliant/hello-docker
If you have been developing for a while, you must have probably come across this situation where your application works on your development machine but does not work somewhere else.
Some reasons may be:
- Missing files
- Version mismatch (e.g Node version)
- Different configuration settings
🐋 This is where Docker comes to the rescue.
🛈 About:
With Docker, we can easily package our application with everything it needs and run it anywhere on any machine.
For example, if an application requires a particular version of Node and MongoDB, all of this will be included in the applications package.You can take this package and run it on any machine that runs Docker.
Moreover, if someone joins your team, they do not have to waste time setting up a new machine to run the application. They simply have to tell Docker to bring up the application and it will automatically download and run these dependencies inside an isolated environment called a 'container' 📦. This isolated environment allows multiple applications use different vesions of some software side by side.
🤔 Containers v/s Virtual Machines (VMs)
Container | Virtual Machine |
---|---|
An isolated environment for running an applicaiton | An abstraction of a machine (physical hardware) |
More lightweight | Need full-blown OS for each VM |
Need less hardware resources | Slow to start and resource intensive |
Compared to VMs, containers can be ran on a single OS host side-by-side.
- Download Docker from the main website
- Follow the system requirements before installation
- After installation, type docker --version in a terminal
- Add docker file to application to start using Docker
The main aim is to learn how to use Docker to consistently build, run, and ship applications.
This project is a tutorial from Programming with Mosh
Created by @MisterValiant - feel free to contact me! 📧