[ovs-dev] [PATCH ovn 3/3] rhel support for ovn container

amginwal at gmail.com amginwal at gmail.com
Sat Oct 26 01:45:55 UTC 2019


From: Aliasgar Ginwala <aginwala at ebay.com>

Current code only had support for starting ovn in ubuntu containers.
This patch adds supprt for rhel using centos7 as a base image

Signed-off-by: Aliasgar Ginwala <aginwala at ebay.com>
---
 Documentation/intro/install/general.rst |  2 +-
 utilities/automake.mk                   |  2 ++
 utilities/docker/rhel/Dockerfile        | 20 +++++++++++++
 utilities/docker/rhel/build.sh          | 38 +++++++++++++++++++++++++
 4 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100755 utilities/docker/rhel/Dockerfile
 create mode 100755 utilities/docker/rhel/build.sh

diff --git a/Documentation/intro/install/general.rst b/Documentation/intro/install/general.rst
index cdd78f7f7..52bfd7d18 100644
--- a/Documentation/intro/install/general.rst
+++ b/Documentation/intro/install/general.rst
@@ -471,7 +471,7 @@ Start OVN containers using unix socket::
 
     User can use any other base image for debian, e.g. u14.04, etc.
 
-    RHEL based docker build support needs to be added.
+    RHEL based docker support is now added with centos7 as a base image.
 
 Starting OVN host service
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/utilities/automake.mk b/utilities/automake.mk
index 0b7e38dc0..73018ca66 100644
--- a/utilities/automake.mk
+++ b/utilities/automake.mk
@@ -40,6 +40,8 @@ EXTRA_DIST += \
     utilities/docker/ovn_default_northd_host \
     utilities/docker/debian/Dockerfile \
     utilities/docker/debian/build.sh \
+    utilities/docker/rhel/Dockerfile \
+    utilities/docker/rhel/build.sh \
     utilities/docker/install_ovn.sh
 
 CLEANFILES += \
diff --git a/utilities/docker/rhel/Dockerfile b/utilities/docker/rhel/Dockerfile
new file mode 100755
index 000000000..e4f5cfece
--- /dev/null
+++ b/utilities/docker/rhel/Dockerfile
@@ -0,0 +1,20 @@
+FROM centos:7
+MAINTAINER "Aliasgar Ginwala" <aginwala at ebay.com>
+
+ARG OVN_BRANCH
+ARG GITHUB_SRC
+ARG DISTRO
+
+copy $DISTRO/build.sh /build.sh
+copy install_ovn.sh /install_ovn.sh
+RUN /build.sh $OVN_BRANCH $GITHUB_SRC
+
+COPY ovn_default_nb_port /etc/ovn/ovn_default_nb_port
+COPY ovn_default_sb_port /etc/ovn/ovn_default_sb_port
+COPY ovn_default_northd_host /etc/ovn/ovn_default_northd_host
+
+COPY start-ovn /bin/start-ovn
+VOLUME ["/var/log/openvswitch", \
+"/var/lib/openvswitch", "/var/run/openvswitch", "/etc/openvswitch", \
+"/var/log/ovn", "/var/lib/ovn", "/var/run/ovn", "/etc/ovn"]
+ENTRYPOINT ["start-ovn"]
diff --git a/utilities/docker/rhel/build.sh b/utilities/docker/rhel/build.sh
new file mode 100755
index 000000000..eb6f85a4a
--- /dev/null
+++ b/utilities/docker/rhel/build.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+OVN_BRANCH=$1
+GITHUB_SRC=$2
+
+# Install deps
+build_deps="rpm-build yum-utils yum-builddep automake autoconf openssl-devel \
+epel-release python3 gdb libtool git bzip2 perl-core zlib-devel openssl git \
+libtool"
+
+yum update -y
+yum install @'Development Tools'  ${build_deps} -y
+pip3 install six
+
+./install_ovn.sh $OVN_BRANCH $GITHUB_SRC
+
+# remove unused packages to make the container light weight.
+for i in $(package-cleanup --leaves --all);
+    do yum remove -y $i; yum autoremove -y;
+done
+yum remove ${build_deps} -y
+cd ..; rm -rf ovs; rm -rf ovn
+
+# Install basic utils
+basic_utils="vim-minimal.x86_64 net-tools.x86_64 uuid.x86_64 iproute.x86_64"
+yum install -y ${basic_utils}
-- 
2.20.1 (Apple Git-117)



More information about the dev mailing list