使用本示例自定义默认定义文件,将 CA 证书包含到 additional-build-files 部分,将该文件移到适当的目录中,最后运行 命令来更新 CA 证书的动态配置,以允许系统信任此 CA 证书。
先决条件
自定义 CA 证书,如 rootCA.crt。
注意
使用 prepend_base 自定义 CA 证书意味着生成的 CA 配置出现在所有其他构建阶段和最终镜像中,因为所有其他构建阶段都继承自基础镜像。
additional_build_files:
# copy the CA public key into the build context, we will copy and use it in the base image later
- src: files/rootCA.crt
dest: configs
additional_build_steps:
prepend_base:
# copy a custom CA cert into the base image and recompute the trust database
# because this is in "base", all stages will inherit (including the final EE)
- COPY _build/configs/rootCA.crt /usr/share/pki/ca-trust-source/anchors
- RUN update-ca-trust
options:
package_manager_path: /usr/bin/microdnf # downstream images use non-standard package manager
[galaxy]
server_list = automation_hub
additional_build_files:
# copy the CA public key into the build context, we will copy and use it in the base image later
- src: files/rootCA.crt
dest: configs
additional_build_steps:
prepend_base:
# copy a custom CA cert into the base image and recompute the trust database
# because this is in "base", all stages will inherit (including the final EE)
- COPY _build/configs/rootCA.crt /usr/share/pki/ca-trust-source/anchors
- RUN update-ca-trust
options:
package_manager_path: /usr/bin/microdnf # downstream images use non-standard package manager
[galaxy]
server_list = automation_hub
Copy to ClipboardCopied!Toggle word wrapToggle overflow