Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

optimization debian package manager tweaks#4474

Closed
rajpratik71 wants to merge 1 commit intoapache:masterfrom
rajpratik71:master
Closed

optimization debian package manager tweaks#4474
rajpratik71 wants to merge 1 commit intoapache:masterfrom
rajpratik71:master

Conversation

@rajpratik71
Copy link

@rajpratik71 rajpratik71 commented Mar 10, 2020

What does this PR (Pull Request) do?

  • This PR is not related to any Issue

By default, Ubuntu-based or Debian-based apt or apt-get system installs recommended - but not suggested - packages .

By passing --no-install-recommends"\ option, the user lets apt-get know not to consider recommended packages as a dependency to install.

This results in smaller downloads and installation of packages .

Refer to blog at Ubuntu Blog .

This PR inserts this option into calls to apt/apt-get in various places throughout the code base.

Which Traffic Control components are affected by this PR?

  • CDN in a Box
  • Documentation

What is the best way to verify this PR?

Build documentation and build and run affected Docker image specifications.

The following criteria are ALL met by this PR

  • Only affects dependency management; building/running is the only testing that makes sense.
  • This PR includes documentation
  • An update to CHANGELOG.md is not necessary
  • This PR includes any and all required license headers
  • This PR does not include a database migration
  • This PR DOES NOT FIX A SERIOUS SECURITY VULNERABILITY

By default, Ubuntu or Debian based "apt" or "apt-get" system installs recommended but not suggested packages .

By passing "--no-install-recommends" option, the user lets apt-get know not to consider recommended packages as a dependency to install.

This results in smaller downloads and installation of packages .

Refer to blog at [Ubuntu Blog](https://ubuntu.com/blog/we-reduced-our-docker-images-by-60-with-no-install-recommends) .

Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
:caption: Install openvpn on ubuntu/debian

apt-get update && apt-get install -y openvpn
apt-get update && apt-get --no-install-recommends install -y openvpn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just for people to install a vpn client on the host, so I don't think there's any need for this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I general updated "apt-get install" with "apt-get --no-install-recommends install" as a best practice for apt-get wherever applicable

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but in this case the user is installing something on their own computer. --no-install-recommends is a "best practice" for the context of docker, but ostensibly the user has the default apt configuration they want on their own host computer. We don't need to worry - and shouldn't worry - about policing that.

.. code-block:: shell

apt-get update && apt-get install -y openvpn
apt-get update && apt-get --no-install-recommends install -y openvpn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I general updated "apt-get install" with "apt-get --no-install-recommends install" as a best practice for apt-get wherever applicable , doesn't have any issue and didn't looked for specific use case

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @ocket8888—We're not in the business of policing a user's own APT configuration.

@rajpratik71 rajpratik71 requested a review from ocket8888 March 11, 2020 14:31
@ocket8888 ocket8888 self-assigned this Mar 11, 2020
@ocket8888 ocket8888 added automation related to automated testing/deployment/packaging etc. build related to the build process cdn-in-a-box related to the Docker-based CDN-in-a-Box system new feature A new feature, capability or behavior low impact affects only a small portion of a CDN, and cannot itself break one labels Mar 11, 2020

# On Ubuntu/Debian/Linux Mint
apt install -y openjdk-8-jdk
apt-get --no-install-recommends install -y openjdk-8-jdk
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above RE: user install recommendations.

&& echo 'APT::Install-Suggests 0;' >> /etc/apt/apt.conf.d/01norecommends \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y vim.tiny wget net-tools sudo net-tools ca-certificates unzip apt-transport-https \
&& DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install -y vim.tiny wget net-tools sudo net-tools ca-certificates unzip apt-transport-https \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lines above

RUN echo 'APT::Install-Recommends 0;' >> /etc/apt/apt.conf.d/01norecommends \
 && echo 'APT::Install-Suggests 0;' >> /etc/apt/apt.conf.d/01norecommends \

updating the APT config to skip package recommendations, so there is no need to pass the --no-install-recommends option with every apt or apt-get command.

&& rm -rf /var/lib/apt/lists/* && rm -rf /etc/apt/apt.conf.d/docker-gzip-indexes \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y bind9=${BIND_VERSION}* bind9-host=${BIND_VERSION}* dnsutils \
&& DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install -y bind9=${BIND_VERSION}* bind9-host=${BIND_VERSION}* dnsutils \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above—We already disable APT::Install-Recommends in the APT configuration in this Dockerfile, so no need to pass the --no-install-recommends CLI option.

FROM debian:stretch

RUN apt-get update && apt-get install -y netcat curl dnsutils net-tools && apt-get clean
RUN apt-get update && apt-get --no-install-recommends install -y netcat curl dnsutils net-tools && apt-get clean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above—I would prefer disabling APT::Install-Recommends and APT::Install-Suggests in the APT configuration to passing --no-install-recommends for every apt or apt-get command.

&& echo 'APT::Install-Suggests 0;' >> /etc/apt/apt.conf.d/01norecommends \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y net-tools ca-certificates dnsutils gettext-base \
&& DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install -y net-tools ca-certificates dnsutils gettext-base \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with the dns Dockerfile,

RUN echo 'APT::Install-Recommends 0;' >> /etc/apt/apt.conf.d/01norecommends \
 && echo 'APT::Install-Suggests 0;' >> /etc/apt/apt.conf.d/01norecommends \

already updates the APT config to skip package recommendations, so there is no need to pass the --no-install-recommends option with every apt or apt-get command.

#FROM buildpack-deps:jessie

RUN apt-get update -y && apt-get install libffi-dev ruby-dev rubygems vim -y
RUN apt-get update -y && apt-get --no-install-recommends install -y libffi-dev ruby-dev rubygems vim -y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above—I would prefer disabling APT::Install-Recommends and APT::Install-Suggests in the APT configuration to passing --no-install-recommends for every apt or apt-get command.


RUN apt-get update && \
apt-get install -y dnsutils net-tools gettext-base netcat && \
apt-get --no-install-recommends install -y dnsutils net-tools gettext-base netcat && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above—I would prefer disabling APT::Install-Recommends and APT::Install-Suggests in the APT configuration to passing --no-install-recommends for every apt or apt-get command.


FROM ubuntu:18.04
RUN apt-get update && apt-get install -y vim tree wget iptables openvpn iputils-ping net-tools dnsutils
RUN apt-get update && apt-get --no-install-recommends install -y vim tree wget iptables openvpn iputils-ping net-tools dnsutils
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above—I would prefer disabling APT::Install-Recommends and APT::Install-Suggests in the APT configuration to passing --no-install-recommends for every apt or apt-get command.


RUN apt-get update && \
apt-get install -y dnsutils net-tools gettext-base p7zip-full netcat && \
apt-get --no-install-recommends install -y dnsutils net-tools gettext-base p7zip-full netcat && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above—I would prefer disabling APT::Install-Recommends and APT::Install-Suggests in the APT configuration to passing --no-install-recommends for every apt or apt-get command.

.. code-block:: shell

apt-get update && apt-get install -y openvpn
apt-get update && apt-get --no-install-recommends install -y openvpn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @ocket8888—We're not in the business of policing a user's own APT configuration.

MAINTAINER dev@trafficcontrol.apache.org

RUN apt-get install -y curl tar xz-utils postgresql-client
RUN apt-get --no-install-recommends install -y curl tar xz-utils postgresql-client
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer disabling APT::Install-Recommends and APT::Install-Suggests in the APT configuration to passing --no-install-recommends for every apt or apt-get command.

@ocket8888
Copy link
Contributor

closing as stale with conflicts; please re-base and re-open or open a new PR to get these changes merged.

@ocket8888 ocket8888 closed this Apr 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

automation related to automated testing/deployment/packaging etc. build related to the build process cdn-in-a-box related to the Docker-based CDN-in-a-Box system low impact affects only a small portion of a CDN, and cannot itself break one new feature A new feature, capability or behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants