A repository containing a short tutorial for Docker (with Python).

Overview

Docker Tutorial for IFT 6758 Lab

image

In this repository, we examine the advtanges of virtualization, what Docker is and how we can deploy simple programs on Docker.

Firstly, we will start by listing some advantages of virtualization. We can discuss them as follows:

  • Minimize hardware costs (Multiple virtual servers on one hardware unit).
  • Easily for HA (High Availability) And Disaster Recovery (DR).
  • Easier to save money and save energy, could be potentially greener.

Problems with Virtualization:

  • Hard to maintain each OS, installation, HyperVisor and host OS compatibility issues, and HyperVisor - container issues.
  • Costly and might take IT/Programming effort.
  • We might need a high storage overhead, even lightweight OSs with all tools installed can bulk up to a high size.

image

Solution?

  • Use containers!

Container definition:

  • is a runnable instance (or sandbox) of an image.
  • can be run on local machines, virtual machines or deployed to the cloud.
  • is portable (can be run on any OS).
  • Containers are isolated from each other and run their own software, binaries, and configurations.

Methodology:

  • These applications share a parent application and its overhead.
  • These apps can run separately, and we can avoid multithreading issues, deadlock issues and other issues with RPCs that may arise.
  • They can't access each other's resources, and they are like apartments in a complex.

Container Architecture:

image

  • Multiple containers run on the same machine virtual / physical machine.
  • All containers share the same OS and Kernel.
  • We can micro-manage processes, and have a higher level and more fine-grained access.
  • We can stop processes using the power of the host OS, and we can even save/move states as we need.
  • We can run containers inside VM! It's interesting as we can combine the power of both if we have a very specialized applicaiton.
  • Higher security as we are working with a very simple isolated block of code.

Compute Comparision:

image

Docker:

Standard definition:

"An open-source project that automates the deployment of software applications inside containers by providing an additional layer of abstraction and automation of OS-level virtualization on Linux."

image

  • Does exactly what we need, and it assists in efficient containerization.
  • Free and Open Source! (now under Moby)
  • Helps in packaing source code, libraries, dependencies, volumes, routes, etc for production.
  • The name Docker had roots from the word "Dock Worker", assists in effective container management.
  • Containers are built from images and saved as images.
  • Each image is identified by a UUID/256 Bit Hash.
  • Each Docker Image has several tags, and we can help in effective versioning.
  • Dockers can be secured by SSH, and additional network security techniques.

image

image

Dockerfile:

  • Dictates the program installation, setup, packaging, instructions, port exposition, etc.
  • We can run a container, list a container, version them, delete them, etc.

Sample Docker Image (for getting started):

docker run -d -p 80:80 docker/getting-started

Tools:

  • Docker Compose: It us used for maintaining and running multi-container Docker applications. We use YAML (mark-up) to dictate the format, dependencies and other nuances of a project. It can aid in building and scaling containers.
  • Docker Volume: We can store and manage separate volumes of code, that avoid deletion when the container is stopped.

Glossary:

  • Docker Daemon: The background service running on the host that manages building, running and distributing Docker containers. The daemon is the process that runs in the operating system which clients talk to.
  • Docker Client: The command line tool that allows the user to interact with the daemon. More generally, there can be other forms of clients too - such as Kitematic which provide a GUI to the users.
  • Docker Hub: A registry of Docker images. You can think of the registry as a directory of all available Docker images. If required, one can host their own Docker registries and can use them for pulling images.
  • Docker Container Image: When running a container, it uses an isolated filesystem. This custom filesystem is provided by a container image. Since the image contains the container's filesystem, it must contain everything needed to run an application - all dependencies, configuration, scripts, binaries, and so on. The image also contains other configuration for the container, such as environment variables, a default command to run, and other metadata.

Folder instructions:

  • Tutorial 1: Demonstrates a basic Docker program.
  • Tutorial 2: Demonstrates simple Redis counter example with compose.
  • Tutorial 3: Docker + NGINX Reverse Proxy + Vanilla MongoDB/NoSQL.
  • Tutorial 4: Same as Tutorial 1, but updated WSGI (Web Server Gateway Interface), instead of a default Flask development WSGI.

References:

  1. https://runnable.com/docker/python/docker-compose-with-flask-apps
  2. https://github.com/docker/awesome-compose
  3. https://docs.docker.com/language/python/build-images/
  4. https://www.cse.wustl.edu/~jain/cse570-18/ftp/m_21cdk.pdf
  5. https://en.wikipedia.org/wiki/Docker_(software)
  6. https://docs.docker.com/compose/
  7. https://docker-curriculum.com/
Owner
Arka Mukherjee
Master's Student in ML and CS @ Mila, University of Montreal
Arka Mukherjee
Hatch plugin for Docker containers

hatch-containers CI/CD Package Meta This provides a plugin for Hatch that allows

Ofek Lev 11 Dec 30, 2022
A Python Implementation for Git for learning

A pure Python implementation for Git based on Buliding Git

shidenggui 42 Jul 13, 2022
Python IMDB Docker - A docker tutorial to containerize a python script.

Python_IMDB_Docker A docker tutorial to containerize a python script. Build the docker in the current directory: docker build -t python-imdb . Run the

Sarthak Babbar 1 Dec 30, 2021
Rundeck / Grafana / Prometheus / Rundeck Exporter integration demo

Rundeck / Prometheus / Grafana integration demo via Rundeck Exporter This is a demo environment that shows how to monitor a Rundeck instance using Run

Reiner 4 Oct 14, 2022
Simple ssh overlay for easy, remote server management written in Python GTK with paramiko

Simple "ssh" overlay for easy, remote server management written in Python GTK with paramiko

kłapouch 3 May 01, 2022
Dynamic DNS service

About nsupdate.info https://nsupdate.info is a free dynamic DNS service. nsupdate.info is also the name of the software used to implement it. If you l

nsupdate.info development 880 Jan 04, 2023
Project 4 Cloud DevOps Nanodegree

Project Overview In this project, you will apply the skills you have acquired in this course to operationalize a Machine Learning Microservice API. Yo

1 Nov 21, 2021
Create pinned requirements.txt inside a Docker image using pip-tools

Pin your Python dependencies! pin-requirements.py is a script that lets you pin your Python dependencies inside a Docker container. Pinning your depen

4 Aug 18, 2022
DataOps framework for Machine Learning projects.

Noronha DataOps Noronha is a Python framework designed to help you orchestrate and manage ML projects life-cycle. It hosts Machine Learning models ins

52 Oct 30, 2022
Apache Airflow - A platform to programmatically author, schedule, and monitor workflows

Apache Airflow Apache Airflow (or simply Airflow) is a platform to programmatically author, schedule, and monitor workflows. When workflows are define

The Apache Software Foundation 28.6k Jan 01, 2023
Ansible for DevOps examples.

Ansible for DevOps Examples This repository contains Ansible examples developed to support different sections of Ansible for DevOps, a book on Ansible

Jeff Geerling 6.6k Jan 08, 2023
Copy a Kubernetes pod and run commands in its environment

copypod Utility for copying a running Kubernetes pod so you can run commands in a copy of its environment, without worrying about it the pod potential

Memrise 4 Apr 08, 2022
Pulumi - Developer-First Infrastructure as Code. Your Cloud, Your Language, Your Way 🚀

Pulumi's Infrastructure as Code SDK is the easiest way to create and deploy cloud software that use containers, serverless functions, hosted services,

Pulumi 14.7k Jan 08, 2023
A system for managing CI data for Mozilla projects

Treeherder Description Treeherder is a reporting dashboard for Mozilla checkins. It allows users to see the results of automatic builds and their resp

Mozilla 235 Dec 22, 2022
Manage your SSH like a boss.

--- storm is a command line tool to manage your ssh connections. features adding, editing, deleting, listing, searching across your SSHConfig. command

Emre Yılmaz 3.9k Jan 03, 2023
Supervisor process control system for UNIX

Supervisor Supervisor is a client/server system that allows its users to control a number of processes on UNIX-like operating systems. Supported Platf

Supervisor 7.6k Dec 31, 2022
Automatically capture your Ookla Speedtest metrics and display them in a Grafana dashboard

Speedtest All-In-One Automatically capture your Ookla Speedtest metrics and display them in a Grafana dashboard. Getting Started About This Code This

Aaron Melton 2 Feb 22, 2022
a CLI that provides a generic automation layer for assessing the security of ML models

Counterfit About | Getting Started | Learn More | Acknowledgments | Contributing | Trademarks | Contact Us -------------------------------------------

Microsoft Azure 575 Jan 02, 2023