Feedback

Chat Icon

Painless Docker - 2nd Edition

A Comprehensive Guide to Mastering Docker and its Ecosystem

Optimizing Docker Builds: Everything You Need to Know
33%

The Base Image

Every image starts from a base image; then, using the layering system of Docker, it builds up to create the final image. The base image is usually an official image with the runtime environment you need (like python, node, or postgres), a minimal Linux distribution (like alpine, debian, or ubuntu), or a custom image you or your organization has created and published to a private registry.

A base image can also be based on other base images, and those images can be based on yet other images, creating a chain of images that ultimately leads back to a base image like scratch - an empty image that is technically the base of all bases.

The base image is specified using the FROM instruction in the Dockerfile. The FROM instruction is typically the first instruction in a Dockerfile, and it sets the stage for all subsequent instructions.

Let's create a simple Dockerfile that uses eon01/hello as the base image.

# Create a folder
mkdir $HOME/hello
cd $HOME/hello

# Create a Dockerfile
cat < Dockerfile
FROM

Painless Docker - 2nd Edition

A Comprehensive Guide to Mastering Docker and its Ecosystem

Enroll now to unlock all content and receive all future updates for free.

Unlock now  $31.99$25.59

Hurry! This limited time offer ends in:

To redeem this offer, copy the coupon code below and apply it at checkout:

Learn More