DEV Community

Cover image for Smallest Docker Image - 92B
Artak Vardanyan
Artak Vardanyan

Posted on

Smallest Docker Image - 92B

Worlds smallest Docker Image - aka WSDI

Hi everyone,

If you ever wondered what is the minimal Docker image in the world, then you are in right place.
Is it debian, is it alpine or busybox ?

Our team at Dooqod did extensive research on to figure out this.

We come up with 2 approaches to figure this out.

Approch 1:

At least there is finate amount of Docker images under DockerHub.
So this task should not be impossible. To run all of them and compare.

But it'll take lots of time and resources.

Approach 2:

We decided to create the smallest one and publish under DockerHub. Sounds promising.

Wow moment

Wow, we can create the smallest Docker image in the wold.
It can be the MVP and we can try to sell it :)

So we started this project right away.

Dockerfile of the 'worlds-smallest-docker-image'

d - is just an emptyfile we add into 'scratch'

FROM scratch
ADD d /d

Enter fullscreen mode Exit fullscreen mode

What is scratch ?

The scratch image is the most minimal image in DockerHub. This is the base ancestor for all other images.
The scratch image is actually empty. It doesn't contain any folders/files.

You can use Docker’s reserved, minimal image, scratch, as a starting point for building containers. Using the scratch “image” signals to the build process that you want the next command in the Dockerfile to be the first filesystem layer in your image.

While scratch appears in Docker’s repository on the hub, you can’t pull it, run it, or tag any image with the name scratch. Instead, you can refer to it in your Dockerfile. For example, to create a minimal container using scratch:

https://hub.docker.com/_/scratch

How to build

# just clone the repo
# cd into repository and run 

docker build -t wsdi .

# or pull from DockerHub

docker pull docker.io/dooqod/wsdi:latest

# check 


Enter fullscreen mode Exit fullscreen mode

Support the project to not grow :)

Our goal is to make this image minimal.
We'll put all our efforts to keep it simple and small also in the feature.

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay