From the course: Docker: Build and Optimize Docker Images
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Choosing a base image - Docker Tutorial
From the course: Docker: Build and Optimize Docker Images
Choosing a base image
- [Instructor] In Docker, choosing the right base image and reducing image layers are key to efficient builds and smaller images. Carefully selecting your starting layer and combining Docker file instructions can cut down image size and build time. Let's see how this can be done. I have the Docker file for our project open in VS Code. The first line contains the from instruction to set the base image, but how do we know which base image to choose? Let's take a look at the node images available in Docker Hub. First, I'll search for node and then click on the official node image. Then let's click the Tags tab. Here you can see every version of the node image that is available. Let's search current Alpine 3.22, which is our base image. Here you can see some important information about the image, including the image size. This is helpful to compare so that you know you're using the most lightweight image that you can for your project. If you click on the image, you can see exactly what is…