7.3. Dockerfile 要求
作为镜像构建流程的一部分,构建服务会扫描您构建的镜像,以确保它符合红帽标准。使用以下指南作为项目中包含的 dockerfile 的基础:
- 基础镜像 必须是一个红帽镜像。任何使用 Ubuntu、Debian 和 CentOS 作为基础的镜像都不会通过扫描程序。
您必须配置所需的标签:
-
name -
maintainer -
vendor -
version -
release -
summary
-
-
您必须在镜像中包含软件许可证作为文本文件。将软件许可证 添加到项目根目录下的
许可证目录中。 -
您必须配置不是
root用户的用户。
以下 dockerfile 示例演示了扫描所需的信息:
FROM registry.redhat.io/rhosp13/openstack-cinder-volume
MAINTAINER VenderX Systems Engineering <maintainer@vendorX.com>
###Required Labels
LABEL name="rhosp13/openstack-cinder-volume-vendorx-plugin" \
maintainer="maintainer@vendorX.com" \
vendor="VendorX" \
version="3.7" \
release="1" \
summary="Red Hat OpenStack Platform 13.0 cinder-volume VendorX PluginY" \
description="Red Hat OpenStack Platform 13.0 cinder-volume VendorX PluginY"
USER root
###Adding package
###repo exmple
COPY vendorX.repo /etc/yum.repos.d/vendorX.repo
###adding package with curl
RUN curl -L -o /verdorX-plugin.rpm http://vendorX.com/vendorX-plugin.rpm
###adding local package
COPY verdorX-plugin.rpm /
# Enable a repo to install a package
RUN yum clean all
RUN yum-config-manager --enable rhel-7-server-openstack-13-rpms
RUN yum install -y vendorX-plugin
RUN yum-config-manager --disable rhel-7-server-openstack-13-rpms
# Add required license as text file in Liceses directory (GPL, MIT, APACHE, Partner End User Agreement, etc)
RUN mkdir /licenses
COPY licensing.txt /licenses
USER cinder