optimization debian package manager tweaks#4474
optimization debian package manager tweaks#4474rajpratik71 wants to merge 1 commit intoapache:masterfrom rajpratik71:master
Conversation
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 |
There was a problem hiding this comment.
This is just for people to install a vpn client on the host, so I don't think there's any need for this.
There was a problem hiding this comment.
I general updated "apt-get install" with "apt-get --no-install-recommends install" as a best practice for apt-get wherever applicable
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Agree with @ocket8888—We're not in the business of policing a user's own APT configuration.
|
|
||
| # On Ubuntu/Debian/Linux Mint | ||
| apt install -y openjdk-8-jdk | ||
| apt-get --no-install-recommends install -y openjdk-8-jdk |
There was a problem hiding this comment.
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 \ |
There was a problem hiding this comment.
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 \ |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 \ |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 && \ |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 && \ |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
|
closing as stale with conflicts; please re-base and re-open or open a new PR to get these changes merged. |
What does this PR (Pull Request) do?
By default, Ubuntu-based or Debian-based
aptorapt-getsystem installs recommended - but not suggested - packages .By passing
--no-install-recommends"\option, the user letsapt-getknow 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-getin various places throughout the code base.Which Traffic Control components are affected by this PR?
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