The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Kick off your book project in 2 hours! Live workshop on Zoom. You’ll leave with a real book project, progress on your first chapter, and a clear plan to keep going. Tuesday, June 16, 2026. Learn more…
Learn how to use Docker in your web projects using Laravel, FastAPI, Django, CodeIgniter, and more
This book offers a comprehensive guide to getting started in the world of Docker, covering everything from the most elementary concepts to the orchestration of complex applications with Docker Compose, with a practical focus for web developers; that is, you will be able to learn how to use Docker to develop your web apps with Laravel, CodeIgniter, Flask, FastAPI, Django and, ultimately, any web app that you can run with Docker or in production.
Minimum price
$3.00
$20.00
About the Book
This book offers a comprehensive guide to getting started in the world of Docker, covering everything from the most elementary concepts to the orchestration of complex applications with Docker Compose, with a practical focus for web developers; that is, you will be able to learn how to use Docker to develop your web apps with Laravel, CodeIgniter, Flask, FastAPI, Django and, ultimately, any web app that you can run with Docker or in production.
Before diving into commands, it is crucial to understand the philosophy behind Docker and its main components.
What is Docker and why use it?Docker is a platform that allows you to package applications along with all their dependencies (libraries, configurations, etc.) into standardized units called containers. The primary goal is to ensure that an application runs consistently in any environment, whether it is a developer's machine, a testing server, or the cloud.
The need for Docker is best understood through analogies. Just as virtual environments in Python (venv, pipenv) isolate a project's dependencies to avoid version conflicts (for example, having one project with Django 4 and another with Django 7 on the same machine), Docker encapsulates the entire application and its environment, preventing compatibility issues with the host operating system and other projects.
Images: Your Application TemplatesA Docker image is an immutable, read-only template that contains everything needed to run an application: the file system, code, libraries, and environment variables. You can think of an image as an .exe file or a class in object-oriented programming: it is a static package that does nothing on its own until it is executed. Examples of popular images include python, ubuntu, nginx, and postgres.
Containers: The Running InstancesA container is a running instance of an image. If the image is the blueprint, the container is the house built from that blueprint. When launching a container, it runs as an isolated process with its own file system, network, and environment, but sharing the host operating system's kernel, which makes it much lighter than a full virtual machine. Containers are portable, self-contained, and can be created, started, stopped, and deleted independently.
To interact with Docker, two main components work together.
The Client (docker) and the Daemon (dockerd)The true power of Docker for developers lies in the ability to create their own images for their projects.
The DockerfileA Dockerfile is a text file without an extension that contains a set of sequential instructions to build a custom image. Its typical structure includes:
Once the Dockerfile is defined, the image is built with the command docker build -t my-app ..
For applications that require multiple services (such as a web application, a database, and a cache server), Docker Compose simplifies management.
What is Docker Compose?It is a tool that allows you to define and run multi-container applications through a single configuration file called docker-compose.yml. In this file, the "services" that make up the application are defined, where each service is a container.
The docker-compose.yml FileThis YAML file defines services, networks, and volumes. For example, you can define a web service for a Flask application and a redis service for the cache. Compose takes care of creating and connecting the containers automatically. The main commands are docker compose up to start the application and docker compose down to stop it.
For Docker to be an efficient development tool, it is essential that code changes are reflected in real-time without the need to constantly rebuild the image.
Volumes for Data PersistenceVolumes allow data to persist beyond the lifecycle of a container. They function like an external hard drive, mounting a directory from the host system inside the container. This is key for development, as the source code can live on the local machine and be "synchronized" with the container.
Docker Compose Watch: Real-Time SynchronizationDocker Compose includes a watch functionality that monitors changes in local files and automatically synchronizes them with the container. This is configured in the docker-compose.yml file within a develop section. By running docker compose up --watch, code changes are instantly reflected in the application running inside the container, creating an agile and efficient development workflow.
About the Author
Andrés Cruz Yoris, Licenciado en Computación, con más de 10 años de experiencia en el desarrollo de aplicaciones web en general; trabajo con PHP, Python y tecnologías del lado del cliente como HTML, JavaScript, CSS, Vue entre otras; y del lado del servidor como Laravel, Flask, Django y Codeigniter. También desarrollo con Android Studio, xCode y Flutter para la creación de aplicaciones nativas para Android e IOS.
Pongo a tú disposición parte de mi aprendizaje, reflejado en cada una de las palabras que componen mis libros sobre el desarrollo de aplicaciones en general.
Translations
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.
Learn more about writing on Leanpub
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.