/etc/containers/registries.conf 是用于配置容器镜像注册库的配置文件,用于指定在补全不包含注册库或域名部分的镜像名称时应查询哪些容器注册库。
注意:在 macOS 或 Windows 系统上,请执行 podman machine ssh 命令进入容器虚拟机,并编辑 /etc/containers/registries.conf 文件添加相同配置内容。若遇到权限问题,请执行 podman machine set --rootful 命令后重试。
来自 Fedora 的 containers-common 软件包的示例
$ cat /etc/containers/registries.conf # For more information on this configuration file, see containers-registries.conf(5). # # NOTE: RISK OF USING UNQUALIFIED IMAGE NAMES # We recommend always using fully qualified image names including the registry # server (full dns name), namespace, image name, and tag # (e.g., registry.redhat.io/ubi8/ubi:latest). Pulling by digest (i.e., # quay.io/repository/name@digest) further eliminates the ambiguity of tags. # When using short names, there is always an inherent risk that the image being # pulled could be spoofed. For example, a user wants to pull an image named # `foobar` from a registry and expects it to come from myregistry.com. If # myregistry.com is not first in the search list, an attacker could place a # different `foobar` image at a registry earlier in the search list. The user # would accidentally pull and run the attacker's image and code rather than the # intended content. We recommend only adding registries which are completely # trusted (i.e., registries which don't allow unknown or anonymous users to # create accounts with arbitrary names). This will prevent an image from being # spoofed, squatted or otherwise made insecure. If it is necessary to use one # of these registries, it should be added at the end of the list. # # # An array of host[:port] registries to try when pulling an unqualified image, in order. unqualified-search-registries = ["registry.fedoraproject.org", "registry.access.redhat.com", "docker.io"] # # [[registry]] # # The "prefix" field is used to choose the relevant [[registry]] TOML table; # # (only) the TOML table with the longest match for the input image name # # (taking into account namespace/repo/tag/digest separators) is used. # # # # If the prefix field is missing, it defaults to be the same as the "location" field. # prefix = "example.com/foo" # # # If true, unencrypted HTTP as well as TLS connections with untrusted # # certificates are allowed. # insecure = false # # # If true, pulling images with matching names is forbidden. # blocked = false # # # The physical location of the "prefix"-rooted namespace. # # # # By default, this equal to "prefix" (in which case "prefix" can be omitted # # and the [[registry]] TOML table can only specify "location"). # # # # Example: Given # # prefix = "example.com/foo" # # location = "internal-registry-for-example.net/bar" # # requests for the image example.com/foo/myimage:latest will actually work with the # # internal-registry-for-example.net/bar/myimage:latest image. # location = "internal-registry-for-example.com/bar" # # # (Possibly-partial) mirrors for the "prefix"-rooted namespace. # # # # The mirrors are attempted in the specified order; the first one that can be # # contacted and contains the image will be used (and if none of the mirrors contains the image, # # the primary location specified by the "registry.location" field, or using the unmodified # # user-specified reference, is tried last). # # # # Each TOML table in the "mirror" array can contain the following fields, with the same semantics # # as if specified in the [[registry]] TOML table directly: # # - location # # - insecure # [[registry.mirror]] # location = "example-mirror-0.local/mirror-for-foo" # [[registry.mirror]] # location = "example-mirror-1.local/mirrors/foo" # insecure = true # # Given the above, a pull of example.com/foo/image:latest will try: # # 1. example-mirror-0.local/mirror-for-foo/image:latest # # 2. example-mirror-1.local/mirrors/foo/image:latest # # 3. internal-registry-for-example.net/bar/image:latest # # in order, and use the first one that exists. # # short-name-mode="enforcing" [[registry]] location="localhost:5000" insecure=true
/usr/share/containers/mounts.conf 及可选的 /etc/containers/mounts.conf
mounts.conf 文件用于指定卷挂载目录,这些目录会在执行 podman run 或 podman build 命令时自动挂载到容器内部。容器进程随后可使用这些内容。卷挂载内容不会被提交到最终镜像中。
通常这些目录用于传递软件包访问远程仓库所需的密钥或凭证。
例如,mounts.conf 中包含“/usr/share/rhel/secrets:/run/secrets”的行,表示将 /usr/share/rhel/secrets 目录的内容挂载到容器内的/run/secrets路径。此挂载点使容器内部能够使用主机端的 Red Hat Enterprise Linux 订阅服务。
注意:这并非卷挂载。卷内容会被复制到容器存储中,而非直接从主机进行绑定挂载。
来自 Fedora 的 containers-common 软件包示例:
cat /usr/share/containers/mounts.conf /usr/share/rhel/secrets:/run/secrets
/usr/share/containers/seccomp.json
seccomp.json 文件包含容器内部允许执行的 seccomp 规则白名单。该文件通常由 containers-common 软件包提供。
上述链接将引导您访问 seccomp.json 文件。
/etc/containers/policy.json
来自 Fedora 的 containers-common 软件包示例:
cat /etc/containers/policy.json
{
"default": [
{
"type": "insecureAcceptAnything"
}
],
"transports":
{
"docker-daemon":
{
"": [{"type":"insecureAcceptAnything"}]
}
}
}原文地址:https://podman.io/docs/installation#configuration-files