Go (Golang) and Docker: Application Containerization
Go (Golang) and Docker: Application Containerization
Summary:
The book "Go (Golang) and Docker: Application Containerization" is a practical guide for developers who want to master modern approaches to packaging, delivering, and running Go applications in containers. Unlike abstract tutorials, this book offers step-by-step instructions, ready-made code examples, and best practices proven in production.
What this book is about
You will learn how to turn a regular Go application into a lightweight, secure, and reproducible Docker image. Special attention is paid to:
- Creating multi-stage Dockerfiles to minimize image size (from 300 MB down to 5–10 MB).
- Optimizing build time using layer caching and Go modules.
- Setting up Docker Compose for local development with databases, Redis, and queues.
- Organizing multi-container architecture for Go microservices.
- Security: running containers as a non-privileged user, vulnerability scanning.
- Integration with CI/CD (GitHub Actions, GitLab CI) for automatic building and publishing of images.
- Logging, monitoring, and debugging containerized Go services.
Who this book is for
- Go developers who want to package their applications into containers without pain.
- DevOps engineers looking for efficient ways to deploy Go services.
- Team leads and architects planning a transition to a microservices architecture.
- Beginners — the book does not require deep knowledge of Docker, but assumes basic familiarity with Go.
What you will learn
- How to properly structure a Go project for containerization.
- Why you should not use Ubuntu-based images for Go applications.
- How to set up hot reload in a container.
- How to manage configuration via environment variables and .env files.
- How to test multi-container applications locally and in the cloud.
- How to deploy Go services to Kubernetes with minimal overhead.
Each chapter contains practical tasks to help reinforce the material. By the end of the book, you will be able to independently create a full-fledged microservice in Go, package it in Docker, and set up automatic deployment.
The book "Go (Golang) and Docker: Application Containerization" is your guide to the world of modern infrastructure, where speed, reliability, and ease of deployment become the standard.