C++ and Docker: Containerization of Applications
C++ and Docker: Containerization of Applications
Summary:
The book "C++ and Docker: Containerization of Applications" is a practical guide for C++ developers who want to master modern approaches to packaging, delivering, and running their code using containers. Unlike typical Docker books focused on web development with Python or Node.js, this edition focuses specifically on the specifics of C++: static and dynamic linking, dependency management, and optimization of build time and final image size.
Who is this book for?
- For C++ developers who want to simplify the deployment of their applications and get rid of the "it works on my machine" problem.
- For DevOps engineers working with high-load C++ systems who need reliable build pipelines.
- For students and novice programmers who want to understand how modern infrastructure combines with a classic language.
What will you learn?
- Docker basics: images, containers, Dockerfile, docker-compose.
- Specifics of containerizing C++ projects: working with system libraries, passing environment variables, managing compiler versions (GCC, Clang).
- Multi-stage builds to minimize image size — from 2 GB down to 50 MB.
- Integration with CMake and Conan for managing dependencies inside the container.
- Creating lightweight images based on Alpine Linux and scratch.
- Testing, debugging, and profiling C++ applications inside a container.
- Orchestration using docker-compose and Kubernetes for microservice architecture in C++.
- Setting up CI/CD pipelines (GitHub Actions, GitLab CI) for automatic building and publishing of images.
The book contains numerous practical examples and ready-made Dockerfiles that can be immediately adapted to your own projects. You will learn not just to "wrap" an application in a container, but to do it optimally: considering layer caching, minimal build time, and security.
After reading, you will be able to confidently containerize both small utilities and complex multi-module C++ projects, as well as integrate Docker into the software development and delivery process.
The example code is available for download on GitHub, and all commands have been tested on current versions of Docker 24+ and C++20.
Recommendations
Web Development with TypeScript: From Basics to Deployment
PHP: Tips and Best Practices
C# (.NET) and Docker: Containerization of Applications
Testing Swift (iOS/macOS) Applications: From Unit Tests to UI Automation
Functional Programming in C++: A Modern Approach
GraphQL in C++: Creating Modern APIs