Add support to the base image for RHEL

Add support to the base image for running RHEL containers.  Document
how to register a system with RHN in image-buliding.rst.

Change-Id: Id69c114cf734a8242066b8d7d05ba19c07af036a
Partially-Implements: blueprint rhel-based-image-support
This commit is contained in:
Steven Dake 2015-09-04 03:17:00 -07:00
parent 6992049323
commit 360999929d
2 changed files with 29 additions and 5 deletions

View File

@ -84,3 +84,20 @@ Now the source type support ``url`` and ``git``. The ``build.ini`` looks like:
type = git type = git
location = https://github.com/openstack/keystone location = https://github.com/openstack/keystone
reference = stable/kilo reference = stable/kilo
To build RHEL containers, it is necessary to use the -i (include header)
feature to include registration with RHN of the container runtime operating
system. To obtain a RHN username/password/pool id, contact Red Hat.
First create a file called rhel-include:
::
RUN subscription-manager register --user=<user-name> --password=<password> \
&& subscription-manager attach --pool <pool-id>
Then build RHEL containers:
::
build -b rhel -i ./rhel-include

View File

@ -6,7 +6,7 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
ENV KOLLA_BASE_DISTRO {{ base_distro }} ENV KOLLA_BASE_DISTRO {{ base_distro }}
ENV KOLLA_INSTALL_TYPE {{ install_type }} ENV KOLLA_INSTALL_TYPE {{ install_type }}
{% if base_distro in ['fedora', 'centos', 'oraclelinux'] %} {% if base_distro in ['fedora', 'centos', 'oraclelinux', 'rhel'] %}
# Turns on MariaDB repos throughout the build # Turns on MariaDB repos throughout the build
COPY mariadb.yum.repo /etc/yum.repos.d/MariaDB.repo COPY mariadb.yum.repo /etc/yum.repos.d/MariaDB.repo
@ -15,7 +15,7 @@ RUN yum install -y http://www.percona.com/redir/downloads/percona-release/redhat
&& sed -i 's|$releasever|centos/latest|g' /etc/yum.repos.d/percona-release.repo && sed -i 's|$releasever|centos/latest|g' /etc/yum.repos.d/percona-release.repo
{% if install_type == 'binary' %} {% if install_type == 'binary' %}
{% if base_distro in ['centos', 'oraclelinux'] %} {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
# Set up repositories # Set up repositories
# This repository provides all dependencies used by RDO OpenStack # This repository provides all dependencies used by RDO OpenStack
@ -29,6 +29,7 @@ RUN curl http://trunk.rdoproject.org/centos7/current/delorean.repo -o /etc/yum.r
RUN rpm -e --nodeps systemd-container systemd-container-libs \ RUN rpm -e --nodeps systemd-container systemd-container-libs \
&& rpm -e --nodeps yum-plugin-fastestmirror \ && rpm -e --nodeps yum-plugin-fastestmirror \
&& yum -d 10 -y install systemd systemd-libs systemd-devel \ && yum -d 10 -y install systemd systemd-libs systemd-devel \
&& yum install -y epel-release \
&& yum clean all && yum clean all
{% endif %} {% endif %}
@ -40,6 +41,14 @@ RUN yum install -y \
RUN yum-config-manager --enable ol7_optional_latest ol7_addons RUN yum-config-manager --enable ol7_optional_latest ol7_addons
{% endif %} {% endif %}
{% if base_distro == 'rhel' %}
RUN yum install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
&& subscription-manager repos --enable rhel-7-server-optional-rpms \
&& subscription-manager repos --enable rhel-7-server-extras-rpms \
&& yum clean all
{% endif %}
# Endif for base_distro centos/oraclelinux # Endif for base_distro centos/oraclelinux
{% elif base_distro == 'fedora' %} {% elif base_distro == 'fedora' %}
@ -48,12 +57,10 @@ RUN yum install -y https://rdo.fedorapeople.org/rdo-release.rpm \
&& yum -y install dnf dnf-plugins-core \ && yum -y install dnf dnf-plugins-core \
&& yum clean all && yum clean all
# Endif for base_distro fedora
{% endif %} {% endif %}
# Update packages # Update packages
RUN yum update -y \ RUN yum update -y \
&& yum install -y epel-release \
&& yum clean all && yum clean all
# Install base packages # Install base packages
@ -171,7 +178,7 @@ RUN yum update -y \
# Endif for install_type source # Endif for install_type source
{% endif %} {% endif %}
# Endif for base_distro centos,fedora,oraclelinux # Endif for base_distro centos,fedora,oraclelinux,rhel
{% elif base_distro in ['ubuntu', 'debian'] %} {% elif base_distro in ['ubuntu', 'debian'] %}
# This will prevent questions from being asked during the install # This will prevent questions from being asked during the install