Faster and Easier Software Development using Docker Platform
The document provides a comprehensive guide on using Docker for software development, covering its introduction, development, deployment, and practical demonstrations. It highlights Docker's containerization technology, its advantages over virtual machines, and various components like Docker images, containers, and volumes. The document also includes examples of Docker commands and showcases several use cases such as deploying web applications and using Docker Compose.
Overview of Docker, its advantages, and terminology including images, containers, and their lifecycle. Highlight of Docker's portability and efficiency.Explains development using Docker, including volume mapping and persistent data management with Docker Volume.
Explains development using Docker, including volume mapping and persistent data management with Docker Volume.
Introduction to Docker commands, Docker Hub usage, and workflow setup. Discusses Docker Compose and development environment organization.
Various deployment strategies using Docker across different platforms including Windows Server and Kubernetes. Introduction to management UI with Portainer.
Practical demonstrations on setup for PHP, databases, and WordPress via Docker including command usage and configuration.
4 What is Docker? •Docker is a platform for developing, shipping and running applications using container virtualization from development to production both on premises and in the cloud. • Docker containers wrap up a piece of software in a complete file system that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. • This guarantees that it will always run the same, regardless of the environment it is running in. https://www.docker.com/
5.
5 Why Docker? Docker createdthe industry standard for containers, so they could be portable anywhere. Docker provides a consistent environment for application from the development all the way to production Applications are safer in containers and Docker provides the strongest default isolation capabilities in the industry Containers share the machine’s OS system kernel and therefore do not require an OS per application, driving higher server efficiencies and reducing server and licensing costs
6.
6 Docker vs VirtualMachine Docker Virtual Machine Source: https://www.docker.com/resources/what-container
7.
7 Docker: Terms Docker Image Thebasis of a Docker container. Represents a full application. Docker Container The standard unit in which the application service resides and executes. Registry Service (Docker Hub or Docker Trusted Registry) Cloud or server based storage and distribution service for your images. Docker Engine Creates, ships and runs Docker containers deployable on a physical or virtual, host locally, in a datacenter or cloud service provider. Docker Volume The storage for persisting data generated by and used by Docker containers.
11 Data Persistence inDocker: Dir Mapping • Use file system directories (mounting from host) during app development. easily to edit app in folder /myapp1 at development host easily to edit app in folder C:Usersuser10html at development host docker run --name mynginx10 –d -v /myapp1/html:/usr/share/nginx/html:ro -P nginx docker run --name mynginx20 –d –v c:/Users/user10/html:/usr/share/nginx/html –p 8080:80 nginx
12.
12 Data Persistence inDocker: Docker Volume • Use Docker volume for app development/deployment docker volume create evoting_db docker run –d –p 3306:3306 -v evoting_db:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=%P1lih4nR4y4#2023! mariadb:10.4-bionic Docker volume evoting_db mapping to MariaDB database folder Creating Docker volume named evoting_db
13.
13 Docker Networking docker run-v /path/to/app:/app –P –-name mynginx bitnami/nginx:latest docker port mynginx 8443/tcp -> 0.0.0.0:32768 8080/tcp -> 0.0.0.0:32769 Open browser: http://localhost:32769 mynginx docker run -v /path/to/app:/app –p 28080:8080 –p 28443:8443 –-name mynginx2 bitnami/nginx:latest docker port mynginx2 8443/tcp -> 0.0.0.0:28443 8080/tcp -> 0.0.0.0:28080 Open browser: http://localhost:28080 mynginx2 System assigned Developer assigned
14.
14 Docker Networking • Createyour own network (private network) for the containers: docker network create predictive_net • Usage: docker run -d --name predictivedb --network predictive_net -v predictive_data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=5up3rS3cr3tD4t4@w0rk mariadb:10.4-bionic docker volume create predictive_data Private network nameContainer name
16 Development using Docker DockerDesktop (Docker CE) Docker in Virtual Machine (Windows/Linux) Docker in Ubuntu Server in LXD in Ubuntu Desktop Canonical MiniK8s Rancher 2.0 RedHat MiniShift (okd.io) Containers in Windows Server 2016/2019 Bare Metal (RancherOS) Kubernetes Kubernetes in LXD VMware vSphere (VMware Photon OS) + more …
21 Basic Software DevelopmentSetup As references OR Used it as is OR Customized it Public Registry INTERNET Private Registry VM LOCAL NETWORK For development For testing For staging For production *Designed by Freepik from www.flaticon.com* * *
24 Docker Hub akaApps Store • Docker Hub is the world’s largest repository of container images with an array of content sources including container community developers, open source projects and independent software vendors (ISV) building and distributing their code in containers. Users get access to free public repositories for storing and sharing images or can choose subscription plan for private repos. • Currently, there are 1,943,463 available images in the Docker Hub (January 27th 2019). https://hub.docker.com/
26 Dockerfile • Docker buildsimages automatically by reading the instructions from a Dockerfile • Dockerfile: a text file that contains all commands, in order, needed to build a given image. • A Dockerfile adheres to a specific format and set of instructions. https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ https://docs.docker.com/engine/reference/builder/ FROM php:7.2-apache COPY src/ /var/www/html/ Dockerfile docker build –t osdec/app1:1.0 . Organization/name/category App name Version/revision/architecture
27.
27 Docker Compose • Composeis a tool for defining and running multi-container Docker applications. • With Compose, you use a YAML file to configure your application’s services. • Then, with a single command, you create and start all the services from your configuration. • Put your recipe into docker-compose.yml • Then run: docker-compose up • To stop: docker-compose down https://docs.docker.com/compose/overview/
31 Deployment using Docker Dockerin Virtual Machine (Linux) Docker Enterprise 2.0 Canonical Charmed Kubernetes Rancher 2.0 RedHat OpenShift 3 SUSE CaaS Platform 3 Containers in Windows Server 2016/2019 Bare Metal (RancherOS) VMware vSphere (VMware Photon OS) Kata Containers 1.5 + more …
32.
32 Windows Server 2019 •Better Container technology than Windows Server 2016. • Come with Docker EE. • More reduced size for Windows images. • Support Docker Swarm clustering. • Registry moved from Docker Hub to Microsoft Private Registry (mcr.microsoft.com). • Support local port bindings. • Support Ingress networking. • Support named pipe in Windows containers. • Integration with Visual Studio IDE.