---
title: We reduced our Docker images by 60% with –no-install-recommends
description: Here at Canonical, we use Dockerfiles on a daily basis for all our web
  projects. Something that caught our attention recently was the amount of space that
  we were using for each Docker image, and we realized that we were installing more
  dependencies than we needed. In this article, I’ll explain how we improved our  […]
url: https://canonical.com/blog/we-reduced-our-docker-images-by-60-with-no-install-recommends
---

1. [Blog](https://canonical.com/blog)
2. Article

---

[Francisco Jiménez Cabrera](https://canonical.com/blog/author/jkfran "More about Francisco Jiménez Cabrera")

15 November 2019

# We reduced our Docker images by 60% with –no-install-recommends

[Design](https://canonical.com/blog/tag/design)
[Development](https://canonical.com/blog/tag/development)
[docker](https://canonical.com/blog/tag/docker)
[web](https://canonical.com/blog/tag/web)

---

Share the article

Here at Canonical, we use Dockerfiles on a daily basis for [all our web projects](https://github.com/search?q=topic%3Awebsite+org%3Acanonical-web-and-design&type=Repositories). Something that caught our attention recently was the amount of space that we were using for each Docker image, and we realized that we were installing more dependencies than we needed.

In this article, I’ll explain how we improved our image build time and reduced the image size by using the flag `--no-install-recommends` in our Dockerfiles.

## Using APT

As you may know, Advanced Package Tool, or APT, is the interface to handle the installation and removal of software on Debian based distributions. It simplifies the process of managing software by automating the retrieval, configuration and installation of software packages.

Every package has different types of dependencies:

* Required packages
* Recommended packages
* Suggested packages

The required packages are mandatory since they are necessary for the correct operation of the package. Still, the recommended and suggested packages are not essential, and they are there to offer some extra functionality that we might not need to use. By default APT will install required and recommended packages.

## Disabling recommended packages

To avoid the installation of recommended packages, we included the flag `--no-install-recommends` when using APT in our Dockerfile.

`RUN apt-get update && apt-get install --no-install-recommends --yes python3`

By doing this, we achieve a decrease of around **60%** in our Docker images size.

This obviously will vary according to the dependencies you are using. In our case, we did it for all our Python websites which reduced the size of all our Docker containers significantly. Also, the build time sped up about **15%.**

I recommend doing this whenever you run apt install in your Dockerfiles, and I hope you find it useful if you are trying to reduce the size of your containers.

It is important to keep in mind that doing this could result in some missing libraries in your projects which you may have to add back explicitly, but this will ultimately give you more control in the dependencies in your project.

Happy dockering!

## Sign up for our newsletter

Get the latest Canonical news and updates in your inbox.

Work email:

\*I agree to receive information about Canonical's
products and services.

In submitting this form, I confirm that I have read and agree to
[Canonical's Privacy Notice](https://canonical.com/legal/data-privacy/contact)
and [Privacy Policy](https://canonical.com/legal/data-privacy).

Sign up

## Share on

---

## Related posts

[### Why web engineering is great](https://canonical.com/blog/why-web-engineering-is-great)

Hi, I’m Johann! I’m an engineering manager in Canonical’s web team. For the larger part of my 15 years of work experience as engineer, I’ve been working in web development....

[Johann Wolf](https://canonical.com/blog/author/johannwolf)

27 April 2026

[### From documentation to design thinking: lessons from Canonical’s Design Academy](https://canonical.com/blog/from-documentation-to-design-thinking-lessons-from-canonicals-design-academy)

Technical Authors at Canonical design experiences: they organize complex information, guide users through unfamiliar systems, and translate technical detail into something...

[Miguel Divo](https://canonical.com/blog/author/mdivo)

18 November 2026

[### Designing a better future: your guide to design contribution in Open Source](https://canonical.com/blog/designing-a-better-future-your-guide-to-design-contribution-in-open-source)

This guide covers why design matters in open source, and how designers can make a bigger impact in open source software.

[Leia Ruffini](https://canonical.com/blog/author/leiaru)

3 November 2026

[### From personas to archetypes: a living, shared understanding of the people we build for (Part 2 of 2)](https://canonical.com/blog/from-personas-to-archetypes-part-2)

This is the second of two posts on our archetypes, shared, machine-readable descriptions of the people we build for. The first covers why we needed them and what they are. This...

[Peter B. Polgár](https://canonical.com/blog/author/polgarp)

23 October 2026
