Major refactoring to basic CentOS and Debian Dockerfiles.
Change-Id: Icf5f48b3de5337f9a88ea276570618f9899b3077
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
[dockerfile]
bears = DockerfileLintBear
-enabled = False
files = **Dockerfile
[json]
# Dockerfile
FROM debian:jessie-backports
+# Schema: https://github.com/projectatomic/ContainerApplicationGenericLabels
+LABEL name="Int/Pack deb-building container" \
+ version="0.1" \
+ vendor="OpenDaylight" \
+ summary="ODL Integration/Packaging container for building .debs" \
+ vcs-url="https://git.opendaylight.org/gerrit/p/integration/packaging.git"
+
ENV DEBIAN_FRONTEND noninteractive
-RUN apt-get update && apt-get install -y \
- build-essential \
- sudo \
- devscripts \
- equivs \
- dh-systemd \
- python-yaml \
- python-jinja2
+
+# Install system-level requirements
+RUN apt-get install -y \
+ build-essential \
+ sudo \
+ devscripts \
+ equivs \
+ dh-systemd \
+ python-yaml \
+ python-jinja2 && \
+ apt-get clean
+
+# ODL Karaf SSH port
+EXPOSE 8101
+
RUN mkdir -p /build
ENTRYPOINT ["/build/build.py"]
CMD ["-h"]
-# OpenDaylight Lithium 0.3.0 DockerFile
-# Based on CentOS
-# https://registry.hub.docker.com/_/centos/
FROM centos:7
-MAINTAINER OpenDaylight Project <info@opendaylight.org>
-# Add repo for ODL
-ADD opendaylight-3-candidate.repo /etc/yum.repos.d/
+# Schema: https://github.com/projectatomic/ContainerApplicationGenericLabels
+LABEL name="Int/Pack CentOS Dockerfile" \
+ version="5.2" \
+ vendor="OpenDaylight" \
+ summary="OpenDaylight Integration/Packaging example CentOS Dockerfile" \
+ vcs-url="https://git.opendaylight.org/gerrit/p/integration/packaging.git"
-# Install required software including OpenDaylight
-RUN yum update -y && yum install -y opendaylight
+# Install OpenDaylight
+RUN yum install -y http://cbs.centos.org/repos/nfv7-opendaylight-52-release/x86_64/os/Packages/opendaylight-5.2.0-1.el7.noarch.rpm && yum clean all
-# Setup Ports:
-
-# TODO: Verify that these are all of the ODL Lithium ports
# Ports
-# 162 - SNMP4SDN (only when started as root)
-# 179 - BGP
-# 1088 - JMX access
-# 1790 - BGP/PCEP
-# 1830 - Netconf
-# 2400 - OSGi console
-# 2550 - ODL Clustering
-# 2551 - ODL Clustering
-# 2552 - ODL Clustering
-# 4189 - PCEP
-# 4342 - Lisp Flow Mapping
-# 5005 - JConsole
-# 5666 - ODL Internal clustering RPC
-# 6633 - OpenFlow
-# 6640 - OVSDB
-# 6653 - OpenFlow
-# 7800 - ODL Clustering
-# 8000 - Java debug access
-# 8080 - OpenDaylight web portal
-# 8101 - KarafSSH
-# 8181 - MD-SAL RESTConf and DLUX
-# 8383 - Netconf
-# 12001 - ODL Clustering
-EXPOSE 162 179 1088 1790 1830 2400 2550 2551 2552 4189 4342 5005 5666 6633 6640 6653 7800 8000 8080 8101 8181 8383 12001
+# 8101 - Karaf SSH
+# Installing additional ODL features may require opening additional ports.
+# https://wiki.opendaylight.org/view/Ports
+EXPOSE 8101
# Start OpenDaylight
-WORKDIR /opt/opendaylight
-CMD ["./bin/karaf", "server"]
+CMD ["/opt/opendaylight/bin/karaf"]
-# OpenDaylight Docker Image
+# Example OpenDaylight CentOS Dockerfile
-The `Dockerfile` in this directory can be used to construct a Docker
-image for the OpenDaylight SDN controller. The currently supported
-OpenDaylight version is [Lithium][1]. Note that Lithium uses Karaf
-to install features, and that the Docker image doesn't install any
-features by default. You'll need to choose which features to install
-based on your use-case.
+Example Dockerfile of OpenDaylight installed from an RPM on CentOS.
-## Pre-Built Docker Image
-
-A pre-built OpenDaylight Lithium image is [available on DockerHub][2].
+## Using
```
-[~/sandbox]$ docker run -ti mgkwill/odl:0.3.0-centos ./bin/karaf
-# ODL's Docker image will be downloaded if needed
-<snip>
-opendaylight-user@root>
-```
-
-## Building ODL's Docker Image
-
-To manually build a Docker image from the included `Dockerfile`:
-
-```
-[~/integration/packaging/docker]$ docker build -t mgkwill/odl:0.3.0-centos .
-[~/integration/packaging/docker]$ docker images | grep odl
-mgkwill/odl 0.3.0 8e0fbf836106 18 hours ago 578.3 MB
+docker build -t <tag> .
+docker run <tag>
+# Karaf shell
```
Replace the tag name with one of your own choosing.
-## Using the Image
-
-To run commands against Dockerized OpenDaylight, use `docker run`. `WORKDIR`
-is set to the root of ODL's install directory, `/opt/opendaylight`. Commands
-passed to `docker run` should be relative to that path.
-
-Additional information about running Docker images can be found [here][3].
-
-### Ports
-
-The OpenDaylight Docker image opens the full set of ports known to be used
-by OpenDaylight generally. For most real-world sets of installed Karaf
-features, only a small subset of these ports will actually be used by
-ODL.
-
-- 162 - SNMP4SDN (only when started as root)
-- 179 - BGP
-- 1088 - JMX access
-- 1790 - BGP/PCEP
-- 1830 - Netconf
-- 2400 - OSGi console
-- 2550 - ODL Clustering
-- 2551 - ODL Clustering
-- 2552 - ODL Clustering
-- 4189 - PCEP
-- 4342 - Lisp Flow Mapping
-- 5005 - JConsole
-- 5666 - ODL Internal clustering RPC
-- 6633 - OpenFlow
-- 6640 - OVSDB
-- 6653 - OpenFlow
-- 7800 - ODL Clustering
-- 8000 - Java debug access
-- 8080 - OpenDaylight web portal
-- 8101 - KarafSSH
-- 8181 - MD-SAL RESTConf and DLUX
-- 8383 - Netconf
-- 12001 - ODL Clustering
-
-By default ports will be mapped to random ports on the host system. The
-mappings can be discovered using the `docker ps` command.
-
-If you wish to map these ports to specific ports on the host system, use
-the `-p <host-port>:<container-port>` flag with `docker run`. Note that
-[container linking][4] is generally recommend over hard-wiring ports with
-`-p`.
+## Other OpenDaylight Containers
-[1]: https://www.opendaylight.org/software/downloads/lithium
+The OpenDaylight Integration/Packaging project maintains a Packer build
+pipeline to build offical containers and VMs. The source can be found in
+[Int/Pack's repo][1], the VMs packaged as [Vagrant boxes on Atlas][2], and
+the [containers on DockerHub][3].
-[2]: https://registry.hub.docker.com/u/mgkwill/odl/
+[1]: https://git.opendaylight.org/gerrit/gitweb?p=integration/packaging.git;a=tree;f=packer;hb=refs/heads/master "ODL Int/Pack repo"
-[3]: https://docs.docker.com/reference/run/
+[2]: https://atlas.hashicorp.com/opendaylight/boxes/odl "ODL Vagrant-based VMs"
-[4]: https://docs.docker.com/userguide/dockerlinks/
+[3]: https://hub.docker.com/r/opendaylight/odl/ "ODL containers"
+++ /dev/null
-[opendaylight-3-candidate]
-name=CentOS CBS OpenDaylight Lithium candidate repository
-baseurl=http://cbs.centos.org/repos/nfv7-opendaylight-3-candidate/$basearch/os/
-enabled=1
-gpgcheck=0
-# OpenDaylight Lithium 0.3.0 DockerFile
-# Based on Debian
-# https://registry.hub.docker.com/_/debian/
FROM debian:7
-MAINTAINER OpenDaylight Project <info@opendaylight.org>
-# Install required software (170MB)
-RUN apt-get update && apt-get install -y openjdk-7-jre-headless wget
+# Schema: https://github.com/projectatomic/ContainerApplicationGenericLabels
+LABEL name="Int/Pack Debian Dockerfile" \
+ version="5.2" \
+ vendor="OpenDaylight" \
+ summary="OpenDaylight Integration/Packaging example Debian Dockerfile" \
+ vcs-url="https://git.opendaylight.org/gerrit/p/integration/packaging.git"
-# Download and install ODL
-WORKDIR /opt
-RUN mkdir opendaylight
-# Doing all of these in one step reduces the resulting image size by 229MB
-RUN wget -q "https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.3.0-Lithium/distribution-karaf-0.3.0-Lithium.tar.gz" && \
- tar -xf distribution-karaf-0.3.0-Lithium.tar.gz -C opendaylight --strip-components=1 && \
- rm distribution-karaf-0.3.0-Lithium.tar.gz
+# Install OpenDaylight
+RUN apt-get install -y http://download.opensuse.org/repositories/home:/akshitajha/xUbuntu_16.04/all/opendaylight_5.0.0-1_all.deb && apt-get clean
-# TODO: Verify that these are all of the ODL Lithium ports
# Ports
-# 162 - SNMP4SDN (only when started as root)
-# 179 - BGP
-# 1088 - JMX access
-# 1790 - BGP/PCEP
-# 1830 - Netconf
-# 2400 - OSGi console
-# 2550 - ODL Clustering
-# 2551 - ODL Clustering
-# 2552 - ODL Clustering
-# 4189 - PCEP
-# 4342 - Lisp Flow Mapping
-# 5005 - JConsole
-# 5666 - ODL Internal clustering RPC
-# 6633 - OpenFlow
-# 6640 - OVSDB
-# 6653 - OpenFlow
-# 7800 - ODL Clustering
-# 8000 - Java debug access
-# 8080 - OpenDaylight web portal
-# 8101 - KarafSSH
-# 8181 - MD-SAL RESTConf and DLUX
-# 8383 - Netconf
-# 12001 - ODL Clustering
-EXPOSE 162 179 1088 1790 1830 2400 2550 2551 2552 4189 4342 5005 5666 6633 6640 6653 7800 8000 8080 8101 8181 8383 12001
+# 8101 - Karaf SSH
+# Installing additional ODL features may require opening additional ports.
+# https://wiki.opendaylight.org/view/Ports
+EXPOSE 8101
-WORKDIR /opt/opendaylight
-ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64/jre
-CMD ["./bin/karaf", "server"]
+# Start OpenDaylight
+CMD ["/opt/opendaylight/bin/karaf"]
-# OpenDaylight Docker Image
+# Example OpenDaylight Debian Dockerfile
-The `Dockerfile` in this directory can be used to construct a Docker
-image for the OpenDaylight SDN controller. The currently supported
-OpenDaylight version is [Lithium][1]. Note that Lithium uses Karaf
-to install features, and that the Docker image doesn't install any
-features by default. You'll need to choose which features to install
-based on your use-case.
+Example Dockerfile of OpenDaylight installed from an RPM on Debian.
-## Pre-Built Docker Image
-
-A pre-built OpenDaylight Lithium image is [available on DockerHub][2].
-
-```
-[~/sandbox]$ docker run -ti mgkwill/odl:0.3.0-debian ./bin/karaf
-# ODL's Docker image will be downloaded if needed
-<snip>
-opendaylight-user@root>
-```
-
-## Building ODL's Docker Image
-
-To manually build a Docker image from the included `Dockerfile`:
+## Using
```
-[~/integration/packaging/docker]$ docker build -t mgkwill/odl:0.3.0-debian .
-[~/integration/packaging/docker]$ docker images | grep odl
-mgkwill/odl 0.3.0 8e0fbf836106 18 hours ago 578.3 MB
+docker build -t <tag> .
+docker run <tag>
+# Karaf shell
```
Replace the tag name with one of your own choosing.
-## Using the Image
-
-To run commands against Dockerized OpenDaylight, use `docker run`. `WORKDIR`
-is set to the root of ODL's install directory, `/opt/opendaylight`. Commands
-passed to `docker run` should be relative to that path.
-
-Additional information about running Docker images can be found [here][3].
-
-### Ports
-
-The OpenDaylight Docker image opens the full set of ports known to be used
-by OpenDaylight generally. For most real-world sets of installed Karaf
-features, only a small subset of these ports will actually be used by
-ODL.
-
-- 162 - SNMP4SDN (only when started as root)
-- 179 - BGP
-- 1088 - JMX access
-- 1790 - BGP/PCEP
-- 1830 - Netconf
-- 2400 - OSGi console
-- 2550 - ODL Clustering
-- 2551 - ODL Clustering
-- 2552 - ODL Clustering
-- 4189 - PCEP
-- 4342 - Lisp Flow Mapping
-- 5005 - JConsole
-- 5666 - ODL Internal clustering RPC
-- 6633 - OpenFlow
-- 6640 - OVSDB
-- 6653 - OpenFlow
-- 7800 - ODL Clustering
-- 8000 - Java debug access
-- 8080 - OpenDaylight web portal
-- 8101 - KarafSSH
-- 8181 - MD-SAL RESTConf and DLUX
-- 8383 - Netconf
-- 12001 - ODL Clustering
-
-By default ports will be mapped to random ports on the host system. The
-mappings can be discovered using the `docker ps` command.
+## Other OpenDaylight Containers
-If you wish to map these ports to specific ports on the host system, use
-the `-p <host-port>:<container-port>` flag with `docker run`. Note that
-[container linking][4] is generally recommend over hard-wiring ports with
-`-p`.
+The OpenDaylight Integration/Packaging project maintains a Packer build
+pipeline to build offical containers and VMs. The source can be found in
+[Int/Pack's repo][1], the VMs packaged as [Vagrant boxes on Atlas][2], and
+the [containers on DockerHub][3].
-[1]: https://www.opendaylight.org/software/downloads/lithium
+Packer builds currently only support CentOS and Fedora.
-[2]: https://registry.hub.docker.com/u/mgkwill/odl/
+[1]: https://git.opendaylight.org/gerrit/gitweb?p=integration/packaging.git;a=tree;f=packer;hb=refs/heads/master "ODL Int/Pack repo"
-[3]: https://docs.docker.com/reference/run/
+[2]: https://atlas.hashicorp.com/opendaylight/boxes/odl "ODL Vagrant-based VMs"
-[4]: https://docs.docker.com/userguide/dockerlinks/
+[3]: https://hub.docker.com/r/opendaylight/odl/ "ODL containers"
-FROM ubuntu:14.04
-MAINTAINER OpenDaylight Integration Project Team <integration-dev@lists.opendaylight.org>
+FROM ubuntu:14.04
-ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
- DEBIAN_FRONTEND=noninteractive
+# Schema: https://github.com/projectatomic/ContainerApplicationGenericLabels
+LABEL name="Int/Pack OpenStack Compute Node" \
+ version="0.1" \
+ vendor="OpenDaylight" \
+ summary="OpenStack compute node for scale testing" \
+ vcs-url="https://git.opendaylight.org/gerrit/p/integration/packaging.git"
+
+ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
+ DEBIAN_FRONTEND=noninteractive
# Install devstack dependencies
-RUN apt-get update && apt-get install -y --no-install-recommends \
- git \
- openssh-server \
- ca-certificates \
- openvswitch-common \
- openvswitch-switch \
- dbus && \
- rm -rf /var/lib/apt/lists/*
+# Start ignoring DockerfileLintBear
+RUN apt-get install -y --no-install-recommends \
+ git \
+ openssh-server \
+ ca-certificates \
+ openvswitch-common \
+ openvswitch-switch \
+ dbus && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/*
+# Stop ignoring
# Add stack user
-RUN groupadd stack && \
- useradd -g stack -s /bin/bash -m stack && \
- echo "stack ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
+RUN groupadd stack && \
+ useradd -g stack -s /bin/bash -m stack && \
+ echo "stack ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Get devstack
-USER stack
-RUN git clone https://git.openstack.org/openstack-dev/devstack /home/stack/devstack
+USER stack
+RUN git clone https://git.openstack.org/openstack-dev/devstack /home/stack/devstack
# Copy and chown local.conf to stack
-COPY local.conf /home/stack/local.conf
-RUN sudo chown stack:stack /home/stack/local.conf
+COPY local.conf /home/stack/local.conf
+RUN sudo chown stack:stack /home/stack/local.conf
# Copy start.sh and chown to stack
-COPY start.sh /home/stack/start.sh
-RUN sudo chown stack:stack /home/stack/start.sh && chmod 766 /home/stack/start.sh
+COPY start.sh /home/stack/start.sh
+RUN sudo chown stack:stack /home/stack/start.sh && chmod 766 /home/stack/start.sh
-CMD ["/home/stack/start.sh"]
+# Open Horizon port
+EXPOSE 80
-# vim: set ft=dockerfile sw=4 ts=4 :
+CMD ["/home/stack/start.sh"]
+# vim: set ft=dockerfile sw=4 ts=4 :
-FROM centos:centos7
+FROM centos:7
-RUN yum -y update && yum -y install epel-release
-RUN yum -y install fedora-packager \
+# Schema: https://github.com/projectatomic/ContainerApplicationGenericLabels
+LABEL name="Int/Pack deb-building container" \
+ version="0.1" \
+ vendor="OpenDaylight" \
+ summary="ODL Integration/Packaging container for building .debs" \
+ vcs-url="https://git.opendaylight.org/gerrit/p/integration/packaging.git"
+
+# Install system-level requirements
+RUN yum install -y epel-release && yum clean all
+RUN yum install -y fedora-packager \
python-pip \
&& yum clean all
-COPY requirements.txt /tmp/requirements.txt
-RUN pip install --upgrade pip && pip install -r /tmp/requirements.txt
+
+# Create user to do the build, add them to mock group
RUN useradd builder
RUN usermod -a -G mock builder
-RUN mkdir -p /build
USER builder
+
+# Install requirements managed by pip
+COPY requirements.txt /tmp/requirements.txt
+RUN pip install --upgrade pip && pip install -r /tmp/requirements.txt
+
+# ODL Karaf SSH port
+EXPOSE 8101
+
+RUN mkdir -p /build
ENTRYPOINT ["/build/build.py"]
CMD ["-h"]
FROM ubuntu:trusty
+# Schema: https://github.com/projectatomic/ContainerApplicationGenericLabels
+LABEL name="OpenDaylght Clustering Tutorial" \
+ version="0.1" \
+ vendor="OpenDaylight" \
+ summary="Integration/Packaging cluster deployment tutorial" \
+ vcs-url="https://git.opendaylight.org/gerrit/p/integration/packaging.git"
+
# As we can't mount folders through docker-compose without
# having them in sync with the host, we're using a
# Dockerfile to bypass this limitation
+# ODL Karaf SSH port
+EXPOSE 8101
+
COPY opendaylight /root/opendaylight
-COPY scripts /root/scripts
\ No newline at end of file
+COPY scripts /root/scripts
+
+CMD ["bash"]