Docker: Build and Optimize Docker Images

Docker: Build and Optimize Docker Images

1h 39mIntermediate2025-08-07

Authors

Shelley Benhoff

Shelley Benhoff

Course details

In this intermediate Docker course, author and Docker Captain Shelley Benhoff shows you how Docker’s layer structure and caching mechanism can dramatically speed up your builds and reduce image sizes. Learn to apply best practices for structuring Dockerfiles, incorporating multi-stage builds, and optimizing the build process for security and efficiency. By the end of this course, you will be able to confidently create lean, maintainable images that follow industry-recommended patterns.

Learning objectives
Work with a registry to pull and push images.
Explain how Docker image layers and caching work to optimize builds.
Write a Dockerfile using best practices to create efficient, maintainable images.
Implement multi-stage builds to reduce image size and improve build speed.
Troubleshoot common issues related to the build process and caching.

Skills covered

Docker Inc.DockerDevOps ToolsDevOpsProject

Concepts

Introduction

  • Understanding Docker images
  • What you should know

Introducing Docker Images

  • Comparing Docker images and containers
  • Why image optimization matters
  • Finding official images on Docker Hub
  • Building custom images
  • Challenge - Finding and building images
  • Solution - Finding and building images

Organizing Images

  • Why image organization matters
  • Tagging Docker images
  • Labeling Docker images
  • Working with tags and labels
  • Working with an image repository
  • Challenge - Tagging and labeling Docker images
  • Solution - Tagging and labeling Docker images

Understanding the Build Cache and Image Layers

  • How Docker builds and layers work
  • Understanding the cache mechanism
  • Excluding unneeded files
  • Building images using caching options
  • Challenge - Working with the build cache
  • Solution - Working with the build cache

Using Dockerfile Best Practices

  • Choosing a base image
  • Incorporating basic security practices
  • Combining commands and maintaining readability
  • Challenge - Optimizing a Dockerfile
  • Solution - Optimizing a Dockerfile

Working with Multi-Stage Builds

  • Why multi-stage builds matter
  • Setting up a multi-stage build
  • Reviewing multi-stage build output
  • Challenge - Setting up a multi-stage Dockerfile
  • Solution - Setting up a multi-stage Dockerfile

Troubleshooting Docker Images

  • Identify common Docker image build errors
  • Using basic debugging techniques
  • Challenge - Debugging Docker images
  • Solution - Debugging Docker images

Conclusion

  • Advancing your Docker skills
40,000 Toman