搜索

2.5. 生成修改后的 horizon 镜像

download PDF

当自定义主题就绪时,您可以创建一个使用主题的新容器镜像。

流程

  1. 使用 Dockerfile 作为原始 horizon 镜像生成新容器镜像,如下例所示:

    FROM registry.redhat.io/rhosp-rhel8/openstack-horizon
    MAINTAINER Acme
    LABEL name="rhosp-rhel8/openstack-horizon-mytheme" vendor="Acme" version="0" release="1"
    COPY mytheme /usr/share/openstack-dashboard/openstack_dashboard/themes/mytheme
    COPY _12_mytheme_theme.py /etc/openstack-dashboard/local_settings.d/_12_mytheme_theme.py
    RUN sudo chown apache:apache /etc/openstack-dashboard/local_settings.d/_12_mytheme_theme.py
  2. 将此文件保存到 horizon-themes 目录中,存为 Dockerfile
  3. 使用 Dockerfile 生成新镜像:

    $ sudo podman build . -t "172.24.10.10:8787/rhosp-rhel8/openstack-horizon:0-5" --log-level debug

    -t 选项名称和标记生成的镜像。它使用以下语法:

    [LOCATION]/[NAME]:[TAG]
    位置
    这通常是 overcloud 最终用于拉取镜像的容器 registry 的位置。在本实例中,您将此镜像推送到 undercloud 的容器 registry,因此将其设置为 undercloud IP 和端口。
    NAME
    为了一致性,这通常与原始容器镜像的名称相同,后跟您的主题的名称。在本例中,它是 rhosp-rhel8/openstack-horizon-mytheme
    TAG
    镜像标签。红帽使用 versionrelease 标签作为此标签的基础。如果您生成此镜像的新版本,请递增发行版版本,例如0-2
  4. 将镜像推送到 undercloud 的容器 registry 中:

    $ sudo openstack tripleo container image push --local 172.24.10.10:8787/rhosp-rhel8/openstack-horizon:0-5
  5. 验证镜像是否已上传到本地 registry:

      [stack@director horizon-themes]$ curl http://172.24.10.10:8787/v2/_catalog | jq .repositories[] | grep -i hori
      "rhosp-rhel8/openstack-horizon"
      [stack@director horizon-themes]$
    
      [stack@director ~]$ sudo openstack tripleo container image list | grep hor
      | docker://director.ctlplane.localdomain:8787/rhosp-rhel8/openstack-horizon:16.0-84
      | docker://director.ctlplane.localdomain:8787/rhosp-rhel8/openstack-horizon:0-5  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<,Uploaded
      [stack@director ~]$
重要

如果更新或升级 Red Hat OpenStack Platform,则必须将主题重新应用到新的 horizon 镜像,并将修改的镜像的新版本推送到 undercloud。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.