This is a small story, How I started with dockers very quickly.
If this is the first you heard about Docker. Its highly recommended reading its wiki page.
Docker is software which allows you to run independently “containers” with single Linux instance, avoid the overhead of running VMs.
If you are an application developer. Have you ever come across these issues.
- “It works on my system”. but not working on another system.
- How difficult, It was for upgrading the underline OS?
- What are the difficulties of automating your app?
I went through pain automation of deployment for my apps. It is more painful your developer machine OS different than deployment server OS.
Docker gives you the flexibility to build, Ship and Run anywhere. Once you containerize your app. It doesn’t matter where you deploy. It works the same.
Docker: Software /Program that performs OS-level virtualization.
Container: A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings
How did I get started?
My case: I was trying to build the web app which has the following structure.
- Python/Django as a backend app for RESTful APIs.
- Angular app for User Interface.
- Postgres as database
- Nginx as a web server and proxy forward to the backend server and UI.
First, I started with Dockerfile.
What is the Dockerfile?:
It has instruction, How should we package software and pre-installation scripts to be added.
For an example: snippet for Python/Django app.
Some more info about dockerfile
For a distributed app, There will be different services to launch. This file will have instructions
- How to launch a service
- How is dependent on other services.
- Command to start.
- Ports to expose
It was an example for my app:
It is important to understand networks in your docker-compose.yml. If you are deploying multiple services. It is important all your services are the same network. Learn more networking in dockers
Here is the GitHub source code which you can use for reference.
I hope it gave starter understanding of dockers.
Enjoy, shipping the containers.
Originally published at gist.github.com.