This product is not supported for your selected Datadog site. ().
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください

Metadata

ID: docker-best-practices/curl-or-wget

Language: Docker

Severity: Warning

Category: Best Practices

Description

This rule enforces the use of either wget or curl exclusively within a Dockerfile, but not both. Mixing these two tools in the same Dockerfile can lead to unnecessary complexity and larger image sizes due to installing multiple similar utilities. It also reduces consistency and maintainability of the Dockerfile.

To comply with this rule, choose either wget or curl based on your preference or the base image’s default availability, and use it consistently throughout your Dockerfile. For example, if you decide to use curl, replace all occurrences of wget with equivalent curl commands like curl -O <url>. This approach ensures clarity and reduces the image footprint.

Non-Compliant Code Examples

FROM debian
RUN curl http://bing.com
ADD something somethingelse
RUN wget http://google.com
FROM debian
RUN wget http://google.com
ADD something somethingelse
RUN curl http://bing.com

Compliant Code Examples

FROM debian
RUN curl http://google.com
RUN curl http://bing.com
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

シームレスな統合。 Datadog Code Security をお試しください