From 360999929d361c5ba8417ee9e9eb25de29671c7f Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Fri, 4 Sep 2015 03:17:00 -0700 Subject: [PATCH] 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 --- doc/image-building.rst | 17 +++++++++++++++++ docker/base/Dockerfile.j2 | 17 ++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/doc/image-building.rst b/doc/image-building.rst index c118fef99c..364c22e733 100644 --- a/doc/image-building.rst +++ b/doc/image-building.rst @@ -84,3 +84,20 @@ Now the source type support ``url`` and ``git``. The ``build.ini`` looks like: type = git location = https://github.com/openstack/keystone 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= --password= \ + && subscription-manager attach --pool + +Then build RHEL containers: + +:: + + build -b rhel -i ./rhel-include diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2 index cd41257f92..71e6edf535 100644 --- a/docker/base/Dockerfile.j2 +++ b/docker/base/Dockerfile.j2 @@ -6,7 +6,7 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) ENV KOLLA_BASE_DISTRO {{ base_distro }} 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 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 {% if install_type == 'binary' %} - {% if base_distro in ['centos', 'oraclelinux'] %} + {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %} # Set up repositories # 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 \ && rpm -e --nodeps yum-plugin-fastestmirror \ && yum -d 10 -y install systemd systemd-libs systemd-devel \ + && yum install -y epel-release \ && yum clean all {% endif %} @@ -40,6 +41,14 @@ RUN yum install -y \ RUN yum-config-manager --enable ol7_optional_latest ol7_addons {% 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 {% 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 clean all - # Endif for base_distro fedora {% endif %} # Update packages RUN yum update -y \ - && yum install -y epel-release \ && yum clean all # Install base packages @@ -171,7 +178,7 @@ RUN yum update -y \ # Endif for install_type source {% endif %} -# Endif for base_distro centos,fedora,oraclelinux +# Endif for base_distro centos,fedora,oraclelinux,rhel {% elif base_distro in ['ubuntu', 'debian'] %} # This will prevent questions from being asked during the install