Skip to navigation Skip to main content

Utilities

  • Subscriptions
  • Downloads
  • Containers
  • Support Cases
Red Hat Customer Portal
  • Subscriptions
  • Downloads
  • Containers
  • Support Cases
  • Products & Services

    Products

    Support

    • Production Support
    • Development Support
    • Product Life Cycles

    Services

    • Consulting
    • Technical Account Management
    • Training & Certifications

    Documentation

    • Red Hat Enterprise Linux
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenStack Platform
    • Red Hat OpenShift Container Platform
    All Documentation

    Ecosystem Catalog

    • Red Hat Partner Ecosystem
    • Partner Resources
  • Tools

    Tools

    • Troubleshoot a product issue
    • Packages
    • Errata

    Customer Portal Labs

    • Configuration
    • Deployment
    • Security
    • Troubleshoot
    All labs

    Red Hat Insights

    Increase visibility into IT operations to detect and resolve technical issues before they impact your business.

    Learn More
    Go to Insights
  • Security

    Red Hat Product Security Center

    Engage with our Red Hat Product Security team, access security updates, and ensure your environments are not exposed to any known security vulnerabilities.

    Product Security Center

    Security Updates

    • Security Advisories
    • Red Hat CVE Database
    • Security Labs

    Keep your systems secure with Red Hat's specialized responses to security vulnerabilities.

    View Responses

    Resources

    • Security Blog
    • Security Measurement
    • Severity Ratings
    • Backporting Policies
    • Product Signing (GPG) Keys
  • Community

    Customer Portal Community

    • Discussions
    • Private Groups
    Community Activity

    Customer Events

    • Red Hat Convergence
    • Red Hat Summit

    Stories

    • Red Hat Subscription Value
    • You Asked. We Acted.
    • Open Source Communities
Or troubleshoot an issue.

Select Your Language

  • English
  • 한국어
  • 日本語
  • 中文 (中国)

Infrastructure and Management

  • Red Hat Enterprise Linux
  • Red Hat Satellite
  • Red Hat Subscription Management
  • Red Hat Insights
  • Red Hat Ansible Automation Platform

Cloud Computing

  • Red Hat OpenShift
  • Red Hat OpenStack Platform
  • Red Hat OpenShift Container Platform
  • Red Hat OpenShift Data Science
  • Red Hat OpenShift Dedicated
  • Red Hat Advanced Cluster Security for Kubernetes
  • Red Hat Advanced Cluster Management for Kubernetes
  • Red Hat Quay
  • OpenShift Dev Spaces
  • Red Hat OpenShift Service on AWS

Storage

  • Red Hat Gluster Storage
  • Red Hat Hyperconverged Infrastructure
  • Red Hat Ceph Storage
  • Red Hat OpenShift Data Foundation

Runtimes

  • Red Hat Runtimes
  • Red Hat JBoss Enterprise Application Platform
  • Red Hat Data Grid
  • Red Hat JBoss Web Server
  • Red Hat Single Sign On
  • Red Hat support for Spring Boot
  • Red Hat build of Node.js
  • Red Hat build of Quarkus

Integration and Automation

  • Red Hat Application Foundations
  • Red Hat Fuse
  • Red Hat AMQ
  • Red Hat 3scale API Management
All Products

Table of contents

  1. 构建(build)
  2. 1. 理解镜像构建
    1. 1.1. 构建(build)
      1. 1.1.1. Docker 构建
      2. 1.1.2. Source-to-Image (S2I) 构建
      3. 1.1.3. Custom 构建
      4. 1.1.4. Pipeline 构建
  3. 2. 了解构建配置
    1. 2.1. BuildConfig
  4. 3. 创建构建输入
    1. 3.1. 构建输入
    2. 3.2. Dockerfile 源
    3. 3.3. 镜像源
    4. 3.4. Git 源
      1. 3.4.1. 使用代理
      2. 3.4.2. 源克隆 secret
        1. 3.4.2.1. 自动把源克隆 secret 添加到构建配置
        2. 3.4.2.2. 手动添加源克隆 secret
        3. 3.4.2.3. 从 .gitconfig 文件创建 secret
        4. 3.4.2.4. 从 .gitconfig 文件为安全 Git 创建 secret
        5. 3.4.2.5. 从源代码基本身份验证创建 secret
        6. 3.4.2.6. 从源代码 SSH 密钥身份验证创建 secret
        7. 3.4.2.7. 从源代码可信证书颁发机构创建 secret
        8. 3.4.2.8. 源 secret 组合
          1. 3.4.2.8.1. 使用 .gitconfig 文件创建基于 SSH 的身份验证 secret
          2. 3.4.2.8.2. 创建组合了 .gitconfig 文件和 CA 证书的 secret
          3. 3.4.2.8.3. 使用 CA 证书创建基本身份验证 secret
          4. 3.4.2.8.4. 使用 .gitconfig 文件创建基本身份验证 secret
          5. 3.4.2.8.5. 使用 .gitconfig 文件和 CA 证书创建基本身份验证 secret
    5. 3.5. 二进制(本地)来源
    6. 3.6. 输入 secret 和配置映射
      1. 3.6.1. 添加输入 secret 和配置映射
      2. 3.6.2. Source-to-Image 策略
      3. 3.6.3. Docker 策略
      4. 3.6.4. Custom 策略
    7. 3.7. 外部工件 (artifact)
    8. 3.8. 将 Docker 凭证用于私有 registry
    9. 3.9. 构建环境
      1. 3.9.1. 使用构建字段作为环境变量
      2. 3.9.2. 使用 secret 作为环境变量
    10. 3.10. 什么是 secret?
      1. 3.10.1. secret 的属性
      2. 3.10.2. secret 的类型
      3. 3.10.3. 更新 secret
      4. 3.10.4. 创建 secret
        1. 3.10.4.1. 使用 secret
    11. 3.11. 服务用(service serving)证书 secret
    12. 3.12. secret 限制
  5. 4. 管理构建输出
    1. 4.1. 构建输出
    2. 4.2. 输出镜像环境变量
    3. 4.3. 输出镜像标签
  6. 5. 使用构建策略
    1. 5.1. Docker 构建
      1. 5.1.1. 替换 Dockerfile FROM 镜像
      2. 5.1.2. 使用 Dockerfile 路径
      3. 5.1.3. 使用 Docker 环境变量
      4. 5.1.4. 添加 Docker 构建参数
    2. 5.2. Source-to-Image (S2I) 构建
      1. 5.2.1. 执行 Source-to-Image (S2I) 增量构建
      2. 5.2.2. 覆盖 Source-to-Image (S2I) 构建器镜像脚本
      3. 5.2.3. Source-to-Image (S2I) 环境变量
        1. 5.2.3.1. 使用 Source-to-Image (S2I) 环境文件
        2. 5.2.3.2. 使用 Source-to-Image (S2I) BuildConfig 环境
      4. 5.2.4. 忽略 Source-to-Image (S2I) 源文件
      5. 5.2.5. 使用 S2I 从源代码创建镜像
        1. 5.2.5.1. 了解 S2I 构建过程
        2. 5.2.5.2. 编写 S2I 脚本
          1. 5.2.5.2.1. S2I 脚本示例
    3. 5.3. Custom 构建
      1. 5.3.1. 使用 FROM 镜像进行自定义构建
      2. 5.3.2. 在自定义构建中使用 secret
      3. 5.3.3. 使用环境变量进行自定义构建
      4. 5.3.4. 使用自定义构建器镜像
        1. 5.3.4.1. 自定义构建器镜像
        2. 5.3.4.2. 自定义构建器工作流
    4. 5.4. Pipeline 构建
      1. 5.4.1. 了解 OpenShift Container Platform 管道
      2. 5.4.2. 为 Pipeline 构建提供 Jenkinsfile
      3. 5.4.3. 使用环境变量进行 Pipeline 构建
        1. 5.4.3.1. BuildConfig 环境变量和 Jenkins 任务参数之间的映射
      4. 5.4.4. Pipeline 构建教程
    5. 5.5. 使用 web 控制台添加 secret
    6. 5.6. 启用拉取 (pull) 和推送 (push)
  7. 6. 使用 Buildah 自定义镜像构建
    1. 6.1. 先决条件
    2. 6.2. 创建自定义构建工件
    3. 6.3. 构建自定义构建器镜像
    4. 6.4. 使用自定义构建器镜像
  8. 7. 执行基本构建
    1. 7.1. 启动构建
      1. 7.1.1. 重新运行构建
      2. 7.1.2. 流传输构建日志
      3. 7.1.3. 在启动构建时设置环境变量
      4. 7.1.4. 使用源启动构建
    2. 7.2. 取消构建
      1. 7.2.1. 取消多个构建
      2. 7.2.2. 取消所有构建
      3. 7.2.3. 取消给定状态下的所有构建
    3. 7.3. 删除 BuildConfig
    4. 7.4. 查看构建详情
    5. 7.5. 访问构建日志
      1. 7.5.1. 访问 BuildConfig 日志
      2. 7.5.2. 访问给定版本构建的 BuildConfig 日志
      3. 7.5.3. 启用日志详细程度
  9. 8. 触发和修改构建
    1. 8.1. 构建触发器
      1. 8.1.1. Webhook 触发器
        1. 8.1.1.1. 使用 GitHub Webhook
        2. 8.1.1.2. 使用 GitLab Webhook
        3. 8.1.1.3. 使用 Bitbucket Webhook
        4. 8.1.1.4. 使用通用 Webhook
        5. 8.1.1.5. 显示 Webhook URL
      2. 8.1.2. 使用镜像更改触发器
      3. 8.1.3. 配置更改触发器
        1. 8.1.3.1. 手动设置触发器
    2. 8.2. 构建 hook
      1. 8.2.1. 配置提交后构建 hook
      2. 8.2.2. 使用 CLI 设置提交后构建 hook
  10. 9. 执行高级构建
    1. 9.1. 设置构建资源
    2. 9.2. 设置最长持续时间
    3. 9.3. 将构建分配给特定的节点
    4. 9.4. 串联构建
    5. 9.5. 修剪构建
    6. 9.6. 构建运行策略
  11. 10. 在构建中使用红帽订阅
    1. 10.1. 创建 Red Hat Universal Base Image 的 ImageStreamTag
    2. 10.2. 将订阅权利添加为构建 secret
    3. 10.3. 使用 Subscription Manager 运行构建
      1. 10.3.1. 将 Subscription Manager 配置添加到构建中
      2. 10.3.2. 使用 Subscription Manager 执行 Docker 构建
    4. 10.4. 使用 Red Hat Satellite 订阅运行构建
      1. 10.4.1. 将 Red Hat Satellite 配置添加到构建中
      2. 10.4.2. 使用 Red Hat Satellite 订阅构建 Docker
    5. 10.5. 对 Docker 的构建层进行压缩
    6. 10.6. 其他资源
  12. 11. 通过策略保护构建
    1. 11.1. 在全局范围内禁用构建策略访问
    2. 11.2. 在全局范围内限制用户使用构建策略
    3. 11.3. 在项目范围内限制用户使用构建策略
  13. 12. 构建配置资源
    1. 12.1. 构建控制器配置参数
    2. 12.2. 配置构建设置
  14. 13. 构建故障排除
    1. 13.1. 解决资源访问遭到拒绝的问题
    2. 13.2. 服务证书生成失败
  15. 14. 为构建设置其他可信证书颁发机构
    1. 14.1. 在集群中添加证书颁发机构
    2. 14.2. 其他资源
  16. 15. 创建和使用 ConfigMap
    1. 15.1. 了解 ConfigMap
    2. 15.2. 创建 ConfigMap
      1. 15.2.1. 从目录创建 ConfigMap
      2. 15.2.2. 从一个文件创建 ConfigMap
      3. 15.2.3. 使用字面值创建 ConfigMap
    3. 15.3. 使用案例: 在 Pod 中使用 ConfigMap
      1. 15.3.1. 使用 ConfigMap 在容器中填充环境变量
      2. 15.3.2. 使用 ConfigMap 为容器命令设置命令行参数
      3. 15.3.3. 使用 ConfigMap 将内容注入卷
  17. 法律通告

14.2. 其他资源

  • 创建 ConfigMap
  • secret 和 ConfigMap
  • 配置自定义 PKI
  1. Previous
  2. Next
Red Hat

Quick Links

  • Downloads
  • Subscriptions
  • Support Cases
  • Customer Service
  • Product Documentation

Help

  • Contact Us
  • Customer Portal FAQ
  • Log-in Assistance

Site Info

  • Trust Red Hat
  • Browser Support Policy
  • Accessibility
  • Awards and Recognition
  • Colophon

Related Sites

  • redhat.com
  • developers.redhat.com
  • connect.redhat.com
  • cloud.redhat.com

About

  • Red Hat Subscription Value
  • About Red Hat
  • Red Hat Jobs
Copyright © 2023 Red Hat, Inc.
  • Privacy Statement
  • Terms of Use
  • All Policies and Guidelines
Red Hat Summit Red Hat Summit
Twitter