This product is not supported for your selected Datadog site. ().
이 페이지는 아직 영어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우 언제든지 연락주시기 바랍니다.

Metadata

ID: docker-best-practices/only-use-allowed-registry

Language: Docker

Severity: Error

Category: Best Practices

Description

This rule enforces the use of only allowed registries in the FROM instruction of a Dockerfile. It ensures that base images are pulled from trusted and verified sources, reducing the risk of introducing malicious or unverified software into your container environment.

To comply with this rule, always specify base images using registries that are explicitly permitted by your organization’s policies. For example, use FROM python:3.6 or FROM docker.io/python:3.6 instead of FROM randomrepo/python:3.6. This practice helps ensure that the images you use are reliable and vetted.

You can specify the exact list of registries to check by defining the registries argument and separate them with a comma. There is an example of how to tweak your configuration file to add registry1 and registry2.

rulesets:
  - docker-best-practices:
    rules:
      only-use-allowed-registry:
        arguments:
          registries: registry1,registry2

Arguments

  • registries: comma-separated list of trusted registries

Non-Compliant Code Examples

FROM registry.somedomain.com/images/mirror/dgraph/dgraph:v1.1.0
FROM x.com/debian
FROM randomrepo/python:3.6
FROM registry.something.io/images/base/ubuntu_2204:release
RUN acommand

Compliant Code Examples

FROM ubuntu:18.04 AS builder1
FROM builder1 AS builder2
FROM python:3.6
RUN acommand
FROM docker.io/python:3.6
FROM scratch
RUN acommand
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

원활한 통합. Datadog Code Security를 경험해 보세요