E-Book, Englisch, 195 Seiten
Bhat Practical Docker with Python
1. ed
ISBN: 978-1-4842-3784-7
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
Build, Release and Distribute your Python App with Docker
E-Book, Englisch, 195 Seiten
ISBN: 978-1-4842-3784-7
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
Learn the key differences between containers and virtual machines. Adopting a project based approach, this book introduces you to a simple Python application to be developed and containerized with Docker.
After an introduction to Containers and Docker you'll be guided through Docker installation and configuration. You'll also learn basic functions and commands used in Docker by running a simple container using Docker commands.
The book then moves on to developing a Python based Messaging Bot using required libraries and virtual environment where you'll add Docker Volumes to your project, ensuring your container data is safe. You'll create a database container and link your project to it and finally, bring up the Bot-associated database all at once with Docker Compose.
What You'll LearnBuild, run, and distribute Docker containers
Develop a Python App and containerize itUse Dockerfile to run the Python AppDefine and run multi-container applications with Docker Compose Work with persisting data generated by and used by Docker containersWho This Book Is For
Intermediate developers/DevOps practitioners who are looking to improve their build and release workflow by containerizing applications
Sathyajith Bhat is a seasoned DevOps/SRE professional currently working as a DevOps Engineer on Adobe I/O, which is Adobe's developer ecosystem and community. Prior to this, he was the lead Ops/SRE at Styletag.com. He transitioned to Ops/SRE after being a lead analyst at CGI, working primarily on Oracle Fusion stack (Oracle DB/PL/SQL/Oracle Forms and other related middleware) designing, architecting, and implementing complete end-to-end solutions for a major insurance provider in the Nordics.
In his free time, Sathya is part of the Barcamp Bangalore planning team, handling DevOps and Social Media for BCB. He is also a volunteer Community Moderator at Super User and Web Apps Stack Exchange, keeps the servers for Indian Video Gamer forums up and running, and was previously a Moderator for Chip-India and Tech 2 forums.
Autoren/Hrsg.
Weitere Infos & Material
1;Table of Contents;5
2;About the Author;8
3;About the Technical Reviewer;9
4;Acknowledgments;10
5;Introduction;11
6;Chapter 1: Introduction to Containerization;12
6.1;What Is Docker?;12
6.1.1;Docker the Company;12
6.1.2;Docker the Software Technology;13
6.1.3;Understanding Problems that Docker Solves;13
6.2;Containerization Through the Years;15
6.2.1;1979: chroot;15
6.2.2;2000: FreeBSD Jails;15
6.2.3;2005: OpenVZ;15
6.2.4;2006: cgroups;16
6.2.5;2008: LXC;16
6.3;Knowing the Difference Between Containers and Virtual Machines;16
6.4;Summary;19
7;Chapter 2: Docker 101;20
7.1;Installing Docker;20
7.1.1;Installing Docker on Windows;21
7.1.2;Installing on MacOS;23
7.1.3;Installing on Linux;24
7.1.3.1;Additional Steps;25
7.1.4;Understanding Jargon Around Docker;27
7.1.4.1;Layers;27
7.1.4.2;Docker Image;28
7.1.4.3;Docker Container;28
7.1.4.4;Bind Mounts and Volumes;29
7.1.4.5;Docker Registry;29
7.1.4.6;Dockerfile;30
7.1.4.7;Docker Engine;31
7.1.4.7.1;Docker Daemon;31
7.1.4.7.2;Docker CLI;31
7.1.4.7.3;Docker API;33
7.1.4.8;Docker Compose;34
7.1.4.9;Docker Machine;34
7.1.5;Hands-On Docker;35
7.1.5.1;Working with Docker Images;37
7.1.5.2;Working with a Real-World Docker Images;41
7.1.6;Summary;49
8;Chapter 3: Building the Python App;50
8.1;About the Project;50
8.1.1;Setting Up Telegram Messenger;51
8.1.2;BotFather: Telegram’s Bot Creation Interface;53
8.1.2.1;Creating the Bot with BotFather;54
8.1.3;Newsbot: The Python App;57
8.1.3.1;Installing Dependencies of Newsbot;57
8.1.3.2;Running Newsbot;58
8.1.3.3;Sending Messages to Newsbot;59
8.1.4;Summary;62
9;Chapter 4: Understanding the Dockerfile;63
9.1;Dockerfile;63
9.1.1;Build Context;64
9.1.2;Dockerignore;65
9.1.3;Building Using Docker Build;66
9.1.4;Dockerfile Instructions;69
9.1.4.1;FROM;70
9.1.4.2;WORKDIR;71
9.1.4.3;ADD and COPY;75
9.1.4.4;RUN;77
9.1.4.5;CMD and ENTRYPOINT;79
9.1.4.5.1;Gotchas About Shell and Exec Form;82
9.1.4.6;ENV;83
9.1.4.7;VOLUME;85
9.1.4.8;EXPOSE;85
9.1.4.9;LABEL;88
9.1.5;Guidelines and Recommendations for Writing Dockerfiles;89
9.1.6;Multi-Stage Builds;90
9.1.7;Dockerfile Exercises;91
9.1.8;Summary;99
10;Chapter 5: Understanding Docker Volumes;100
10.1;Data Persistence;100
10.1.1;Example of Data Loss Within Docker Container;101
10.1.1.1;tmpfs Mounts;103
10.1.1.2;Bind Mounts;104
10.1.1.3;Volumes;108
10.1.1.3.1;Docker Volume Subcommands;109
10.1.1.3.1.1;Create Volume;109
10.1.1.3.1.2;Inspect;110
10.1.1.3.1.3;List Volumes;111
10.1.1.3.1.4;Prune Volumes;111
10.1.1.3.1.5;Remove Volumes;111
10.1.1.3.2;Using Volumes When Starting a Container;112
10.1.1.3.3;VOLUME Instruction in Dockerfile;115
10.1.2;Docker Volume Exercises;116
10.1.3;Summary;127
11;Chapter 6: Understanding Docker Networks;128
11.1;Why Do We Need Container Networking?;128
11.1.1;Default Docker Network Drivers;129
11.1.1.1;Bridge Network;129
11.1.1.2;Host Network;130
11.1.1.3;Overlay Network;131
11.1.1.4;Macvlan Networks;131
11.1.1.5;None Networking;131
11.1.2;Working with Docker Networks;132
11.1.2.1;Bridge Networks;136
11.1.2.1.1;Creating Named Bridge Networks;141
11.1.2.1.2;Connecting Containers to Named Bridge Networks;146
11.1.2.2;Host Networks;150
11.2;Docker Networking Exercises;151
11.3;Summary;159
12;Chapter 7: Understanding Docker Compose;160
12.1;Overview of Docker Compose;160
12.1.1;Installing Docker Compose;162
12.1.2;Docker Compose Basics;163
12.1.2.1;Compose File Versioning;163
12.1.2.1.1;Version 1;164
12.1.2.1.2;Version 2;164
12.1.2.1.3;Version 3;164
12.1.3;Docker Compose File Reference;168
12.1.3.1;Services;168
12.1.3.1.1;build;168
12.1.3.1.2;context;169
12.1.3.2;image;169
12.1.3.2.1;environment/env_file;169
12.1.3.2.2;depends_on;170
12.1.3.2.3;image;171
12.1.3.3;ports;171
12.1.3.4;volumes;172
12.1.3.5;Restart;174
12.1.4;Docker Compose CLI Reference;175
12.1.4.1;build;175
12.1.4.2;down;175
12.1.4.3;exec;175
12.1.4.4;logs;176
12.1.4.5;stop;176
12.1.5;Docker Volume Exercises;176
12.1.6;Summary;191
13;Index;192




