generic.dockerfile.correctness.missing-assume-yes-switch.missing-assume-yes-switch

Author
2,919
Download Count*
License
This 'apt-get install' is missing the '-y' switch. This might stall builds because it requires human intervention. Add the '-y' switch.
Run Locally
Run in CI
Defintion
rules:
- id: missing-assume-yes-switch
patterns:
- pattern: |
RUN ... apt-get install ... $SOMETHING
- pattern-not-inside: |
RUN ... apt-get install ... -y
- pattern-not-inside: |
RUN ... apt-get install ... --assume-yes
- pattern-not-inside: |
RUN ... apt-get install ... --yes
languages:
- generic
message: This 'apt-get install' is missing the '-y' switch. This might stall
builds because it requires human intervention. Add the '-y' switch.
severity: WARNING
metadata:
source-rule-url: https://github.com/hadolint/hadolint/wiki/DL3014
references:
- https://github.com/hadolint/hadolint/wiki/DL3014
category: correctness
technology:
- dockerfile
license: Commons Clause License Condition v1.0[LGPL-2.1-only]
paths:
include:
- "*dockerfile*"
- "*Dockerfile*"
Examples
missing-assume-yes-switch.dockerfile
FROM debian
# ruleid: missing-assume-yes-switch
RUN apt-get install semgrep=0.30.0
# ok: missing-assume-yes-switch
RUN apt-get install -y python=2.7 semgrep
# ok: missing-assume-yes-switch
RUN apt-get install --no-install-recommends -y python=2.7 semgrep
# ok: missing-assume-yes-switch
RUN apt-get install -y python=2.7
# ok: missing-assume-yes-switch
RUN apt-get install --yes python=2.7
# ok: missing-assume-yes-switch
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-setuptools \
libpython3-dev \
python3-dev \
git \
ca-certificates \
zip \
jq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# ruleid: missing-assume-yes-switch
RUN apt-get update \
&& apt-get install --no-install-recommends \
python3 \
python3-pip \
python3-setuptools \
libpython3-dev \
python3-dev \
git \
ca-certificates \
zip \
jq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# ok: missing-assume-yes-switch
RUN apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
python3 \
python3-pip \
python3-setuptools \
libpython3-dev \
python3-dev \
git \
ca-certificates \
zip \
jq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Short Link: https://sg.run/yd4d