SESSION details

Name: Dockerfile: from Start to Optimized

Date/time: Thursday, October 5, 2023, 2:05 PM - 2:50 PM Pacific Time


Do you want to learn about how to write a Dockerfile and then optimize it? This talk is for you! After this talk, you’ll have a good understanding of what Dockerfile instructions do and some patterns for optimizing your Dockerfile for quicker builds.

The talk starts out with a basic HTTP server, written in Go, and no Dockerfile. By the end of the presentation, you will have an optimized Dockerfile for building and running the application.

The outline for the talk is as follows:

1. Introduction and overview of the existing application.

2. Introduction to Dockerfiles, what they are, and what they help you achieve.

3. Creating a simple Dockerfile that builds and runs our application as a container image.

4. Describing image layers, layer cache, and how we can edit our Dockerfile to improve build speed.

5. Decoupling app build and runtime, using multi-stage builds, to help reduce the size of the final image.

6. Showing how to parallelize build steps.

7. Adding cache mounts and bind mounts to avoid copying and re-downloading dependencies unnecessarily.

8. Showing how you can use build arguments to allow for build-time variables to be used in the build.

9. Showing how you can use Dockerfile to run application tests in a reproducible way across environments.

10. Adding multi-platform support to build the application for multiple different architectures.

After the talk, you will have a better understanding of the modern capabilities that Docker Build provides, best practices, and common patterns. You will have a solid foundation and be better equipped to make the most of the available features. You will be able to craft better Dockerfiles and have an easier time understanding advanced uses of Docker when you encounter them.