This product is not supported for your selected Datadog site. ().
Cette page n'est pas encore disponible en français, sa traduction est en cours. Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.
Metadata
ID:docker-best-practices/avoid-add-use-copy
Language: Docker
Severity: Info
Category: Best Practices
Description
This rule encourages the use of COPY instead of ADD in Dockerfiles when simply copying files or directories. While both instructions can copy files into the image, ADD has additional functionality such as extracting local tar archives and fetching remote URLs, which can introduce unexpected behavior.
Using COPY is preferred because it is more explicit and predictable, reducing the risk of unintended side effects that could occur with ADD. This leads to clearer, more maintainable Dockerfiles and helps avoid security issues related to downloading remote files during the build process.