- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
ID: docker-best-practices/apt-get-yes
Language: Docker
Severity: Warning
Category: Best Practices
The rule “Always use -y with apt-get install” is a best practice in Dockerfile development to ensure that the Docker build process is non-interactive. Dockerfiles should be designed to build without requiring any user intervention. By using the -y
flag with apt-get install
, you can automatically answer yes to any prompts that the installation process might produce, making the process non-interactive.
This rule is crucial because a Docker build that requires user interaction can cause problems in automated build systems. It can lead to build failures or unexpected results due to lack of user response. This is especially important in CI/CD pipelines where the Docker build process should be fully automated.
To adhere to this rule, always include the -y
flag when using apt-get install
in your Dockerfiles. For example, instead of writing RUN apt-get install gcc
, write RUN apt-get install -y gcc
. Also, to avoid potential issues with locale settings, you can use DEBIAN_FRONTEND=noninteractive
in conjunction with apt-get install
. For instance, RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y git
.
RUN apt-get install gcc
RUN apt-get install -y gcc
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install git
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install git
|
|
For more information, please read the Code Analysis documentation
Identify code vulnerabilities directly in yourVS Code editor
Identify code vulnerabilities directly inJetBrains products