Este producto no es compatible con el sitio Datadog seleccionado. ().
Esta página aún no está disponible en español. Estamos trabajando en su traducción.
Si tienes alguna pregunta o comentario sobre nuestro actual proyecto de traducción, no dudes en ponerte en contacto con nosotros.

Metadata

ID: docker-best-practices/yarn-clean

Language: Docker

Severity: Warning

Category: Best Practices

Description

This rule ensures that after running yarn install in a Dockerfile, a yarn cache clean command is executed to remove unnecessary cache files. This practice helps to minimize the image size by cleaning up temporary files and caches that are not needed for the runtime environment. mes.

To comply with this rule, always chain yarn install with yarn cache clean in the same RUN instruction like RUN yarn install && yarn cache clean. This approach ensures that the cache cleanup happens immediately after installation, reducing the number of layers and keeping the image optimized.

Non-Compliant Code Examples

RUN yarn install

Compliant Code Examples

RUN yarn install \
 && yarn cache clean
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Integraciones sin problemas. Prueba Datadog Code Security