Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use --no-install-recommends in dockerfiles #2656

Open
cdrini opened this issue Nov 19, 2019 · 4 comments
Open

Use --no-install-recommends in dockerfiles #2656

cdrini opened this issue Nov 19, 2019 · 4 comments
Assignees
Labels
Good First Issue Easy issue. Good for newcomers. [managed] Lead: @cdrini Issues overseen by Drini (Staff: Team Lead & Solr, Library Explorer, i18n) [managed] Module: Docker Issues related to the configuration or use of Docker. [managed] Priority: 3 Issues that we can consider at our leisure. [managed] Theme: Development Issues related to the developer experience and the dev environment. [managed] Type: Refactor/Clean-up Issues related to reorganization/clean-up of data or code (e.g. for maintainability). [managed]

Comments

@cdrini
Copy link
Collaborator

cdrini commented Nov 19, 2019

Anywhere we use apt-get install in our Dockerfiles, we should also add --no-install-recommends. According to https://ubuntu.com/blog/we-reduced-our-docker-images-by-60-with-no-install-recommends this creates smaller images which build faster. Note:

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.

@cdrini cdrini added Type: Refactor/Clean-up Issues related to reorganization/clean-up of data or code (e.g. for maintainability). [managed] Module: Docker Issues related to the configuration or use of Docker. [managed] Theme: Development Issues related to the developer experience and the dev environment. [managed] labels Nov 19, 2019
@xayhewalo xayhewalo added this to Un-Triaged in Triage Nov 19, 2019
@xayhewalo xayhewalo added Needs: Triage This issue needs triage. The team needs to decide who should own it, what to do, by when. [managed] Priority: 3 Issues that we can consider at our leisure. [managed] State: Backlogged labels Nov 26, 2019
@xayhewalo xayhewalo moved this from Un-Triaged to Needs: Assessment in Triage Nov 26, 2019
@Kaushl2208
Copy link
Contributor

Hey @guyjeangilles, It seems like a good fix. Can I work on it?

@mekarpeles mekarpeles added Lead: @mekarpeles Issues overseen by Mek (Staff: Program Lead) [managed] and removed State: Backlogged labels Feb 12, 2020
@mekarpeles
Copy link
Member

Go for it @Kaushl2208! :)

@mekarpeles mekarpeles removed the Needs: Triage This issue needs triage. The team needs to decide who should own it, what to do, by when. [managed] label Apr 20, 2020
@mekarpeles mekarpeles added Good First Issue Easy issue. Good for newcomers. [managed] Needs: Help Issues, typically substantial ones, that need a dedicated developer to take them on. [managed] Lead: @cdrini Issues overseen by Drini (Staff: Team Lead & Solr, Library Explorer, i18n) [managed] and removed Lead: @mekarpeles Issues overseen by Mek (Staff: Program Lead) [managed] labels Dec 20, 2022
@mekarpeles
Copy link
Member

If someone wants to try adding these tags and build new images + see if anything breaks, that would be a great fist step

@scottbarnes
Copy link
Collaborator

scottbarnes commented Feb 11, 2023

I realized I forgot to share my write up of trying this out on the two apt-get lines in docker/Dockerfile.olbase that currently lack --no-install-recommends. How embarrassing!

The short of it is that the savings were fairly modest.

Results of adding --no-install-recommends the first apt-get line (line 17 of Dockrefile.olbase)

Sizes

  • Before: <missing> 3 weeks ago /bin/sh -c apt-get -qq update && apt-get ins… 727MB
  • After : 5dcd206fa807 29 minutes ago /bin/sh -c apt-get -qq update && apt-get ins… 624MB

Site status

  • It seems to work.
  • Webpack appears to compile things properly. (docker-compose run --rm web npm run watch)
  • I can search for a book (Flatland), find it, and look at the entry.
  • I can also mark it as 'Want to Read', visit my reading log, see it, and find it there with a search for "flat*", etc.

Results of adding --no-install-recommends the apt-get install -y nodejs line (line 39 of Dockrefile.olbase)

Sizes

  • Before: <missing> 3 weeks ago /bin/sh -c apt-get update && apt-get install… 10.6MB
  • After : <missing> 7 minutes ago /bin/sh -c apt-get update && apt-get -y inst… 10.1MB

Site status

  • It seems to work.
  • Webpack appears to compile things properly. (docker-compose run --rm web npm run watch)
  • I can search for a book (Flatland), find it, and look at the entry.
  • I can also mark it as 'Want to Read', visit my reading log, see it, and find it there with a search for "flat*", etc.

APT packages

I also tried using the 'no-x' version of vim and emacs:

  • Without -nox on the editors: 606MB
  • With -nox 543MB

Total savings, including use of -nox versions of the editors: 166MB.

@mekarpeles

@mekarpeles mekarpeles removed the Needs: Help Issues, typically substantial ones, that need a dedicated developer to take them on. [managed] label Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Easy issue. Good for newcomers. [managed] Lead: @cdrini Issues overseen by Drini (Staff: Team Lead & Solr, Library Explorer, i18n) [managed] Module: Docker Issues related to the configuration or use of Docker. [managed] Priority: 3 Issues that we can consider at our leisure. [managed] Theme: Development Issues related to the developer experience and the dev environment. [managed] Type: Refactor/Clean-up Issues related to reorganization/clean-up of data or code (e.g. for maintainability). [managed]
Projects
No open projects
Triage
  
Needs: Assessment
Development

Successfully merging a pull request may close this issue.

5 participants