Dockerfile Best Practices
Offered By: Docker via YouTube
Course Description
Overview
Learn essential Dockerfile best practices in this 38-minute video from Docker. Explore techniques to optimize image builds, improve caching, and reduce image size. Discover how to effectively use multi-stage builds, manage dependencies, and leverage BuildKit features. Gain insights into creating efficient Dockerfiles for various environments including development, testing, and production. Master strategies to enhance Docker image performance and streamline your containerization workflow.
Syllabus
Intro
Pocket Guide
Quick refresher on Images
Quick refresher on Build
Areas of improvements
Example project
Order matters for caching
More specific COPY to limit cache bust
Line buddies: apt-get update & install
Remove unnecessary dependencies
Use --no-install-recommends
Remove package manager cache
Reuse official images when possible
Use more specific tags
Build from source in a consistent environment
Cache dependencies
Identify build dependencies
Multi-stage builds to remove build deps
Multi-stage usecases
Various environments: build, dev, test, lint,...
Multi-stage: build concurrently
Benchmarks
Supercharged Docker Build with BuildKit
Context mounts (v18.09 only)
Application cache (v18.09 only)
Improvements recap
Taught by
Docker
Related Courses
Architecting .NET Microservices in a Docker EcosystemDocker via YouTube Docker and Pyrsia - Securing the Software Supply Chain
Docker via YouTube Removing Complexity from Integration Tests Using Testcontainers
Docker via YouTube Running an AWS Stack on Your Local Machine
Docker via YouTube Building Observability for 99% Developers
Docker via YouTube