Initial commit of docker image building support
authorDavid K. Bainbridge <dbainbri@ciena.com>
Tue, 21 Jan 2014 21:11:10 +0000 (13:11 -0800)
committerDavid K. Bainbridge <dbainbri@ciena.com>
Tue, 21 Jan 2014 21:11:10 +0000 (13:11 -0800)
Signed-off-by: David K. Bainbridge <dbainbri@ciena.com>
packaging/docker/README.md [new file with mode: 0644]
packaging/docker/base/Dockerfile [new file with mode: 0644]
packaging/docker/base/pom.xml [new file with mode: 0644]
packaging/docker/pom.xml [new file with mode: 0644]
packaging/docker/release/Dockerfile.base [new file with mode: 0644]
packaging/docker/release/Dockerfile.serviceprovider [new file with mode: 0644]
packaging/docker/release/Dockerfile.virtualization [new file with mode: 0644]
packaging/docker/serviceprovider/Dockerfile [new file with mode: 0644]
packaging/docker/serviceprovider/pom.xml [new file with mode: 0644]
packaging/docker/virtualization/Dockerfile [new file with mode: 0644]
packaging/docker/virtualization/pom.xml [new file with mode: 0644]

diff --git a/packaging/docker/README.md b/packaging/docker/README.md
new file mode 100644 (file)
index 0000000..b0af741
--- /dev/null
@@ -0,0 +1,81 @@
+What is Docker
+==============
+Docker, provided by [docker.io](http://docker.io), and available in most Linux distributions as well as available on MacOS and Windows, is an open-source project to easily create lightweight, portable, self-sufficient containers from any application. The same container that a developer builds and tests on a laptop can run at scale, in production, on VMs, bare metal, OpenStack clusters, public clouds and more.
+
+_For more information on docker please read [docker.io's documentation](http://docker.io)._ 
+
+The sudo command and the docker Group
+=====================================
+(reprinted from [docker.io's basic documentation](http://docs.docker.io/en/latest/use/basics/)):
+
+The docker daemon always runs as the root user, and since Docker version 0.5.2, the docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root, and so, by default, you can access it with sudo.
+
+Starting in version 0.5.3, if you (or your Docker installer) create a Unix group called docker and add users to it, then the docker daemon will make the ownership of the Unix socket read/writable by the docker group when the daemon starts. The docker daemon must always run as the root user, but if you run the docker client as a user in the docker group then you don’t need to add sudo to all the client commands.
+
+OpenDaylight Docker Images
+==========================
+The `Dockerfile`s in these directories can be used to construct a docker image for an OpenDaylight SDN controller. These Dockerfiles rely on the presense of an OpenDaylight distribution in the sub-directory `target/dist`. The distribution should be a `ZIP` file as generated by an OpenDaylight source build or as downloaded from the [OpenDaylight Nexus server](https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/org/opendaylight/integration).
+
+Pre-built Image
+===============
+If you would like to use the OpenDaylight SDN controller as a docker image, but do not wish to build the image yourself. There are public images available via the public docker respository. You can find the images by issuing a docker search command looking for __opendaylight__ i.e.
+
+    $ docker search opendaylight
+    Found 3 results matching your query ("opendaylight")
+    NAME                             DESCRIPTION
+    opendaylight/base                The base OpenDaylight SDN controlelr
+    opendaylight/serviceprovider     The service provider version of the OpenDaylight SDN controller
+    opendaylight/virtualization      The virtualization version of the OpenDaylight SDN controller
+
+Each of these images have version tags that allow the sepecification of the version via the version name. `latest` is also a support tag to identify the latest offical release. For the first release of OpenDaylight, the version tag is "hydrogen".
+
+Build Image
+===========
+If you would like to build the image manually then this can be done by performing a `mvn install` command from the top of the OpenDaylight docker module `integration/packaging/docker` or in the sub-directory for the edition in which you are interested, i.e., `integration/packaging/docker/base`. This will retrieve the latest artifacts from your local maven repository and copy them to the `target/dist` sub-directory in the associated edition directories in preparation to build the docker images.
+
+Once the distribution `ZIP` file is in the `target/dist` sub-directory the image can be built from the edition sub-directories using with the following command:
+
+    docker build -t="<respository>/<name>:<tag>" -rm .
+
+When issuing this command you can replace the the `<repository>/<name>:<tag>` values with any name you would like, or none if you wish to only using the generated image identifiers. As an exmaple:
+
+    docker build -t="joeuser/opendaylight:mytag" -rm .
+
+More information about the docker build command can be found at [docker.io's documenation page](http://docs.docker.io/en/latest/commandline/cli/#cli-build).
+
+Release Images
+==============
+In the `release` sub-directory, additional Dockerfiles are located. These Dockerfiles can be used to build a docker image by directly downloading the distribution files from the OpenDaylight Nexus repository. These are the files that are used to build the official images that are published to the [docker.io public repository](index.docker.io).
+
+The following command can be used to build images using these files:
+
+    docker build -rm - < Dockerfile.<edition>
+
+Using the Image
+===============
+The OpenDaylight docker image is meant to be used to start an instance of the OpenDaylight SDN controller and that process will be invoked when the docker image is __run__. Any command line options you append to the `docker run` command will be passed on to the the OpenDaylight `run.sh` startup script. In its simpliest form you can invoke an instance of the Opendaylight controller using the command:
+
+    docker run -d <image-identifier> 
+
+Where `<image-identifier>` can be one of the pre-build image references, i.e. `opendaylight/base:hydrogen`, or it can reference the docker image you may have created using the `Dockerfile` and the `docker build` command.
+
+Additional information and options for _running_ a docker image can be found at [docker.io's run documentation](http://docs.docker.io/en/latest/commandline/cli/#run).
+
+Ports
+-----
+The OpenDaylight controller image will expose the following ports from the container to the host system:
+
++ 1088 - JMX access
++ 1830 - Netconf use 
++ 2400 - OSGi console
++ 6633 - OpenFlow use
++ 8000 - Java debug access
++ 8080 - OpenDaylight web portal
++ 8383 - Netconf use
+
+By default these ports will be mapped to random ports on the host system (i.e. the system on which the `docker run` command is invoked). The mappings can be discovered using the `docker ps` command. To understand how to enable docker container instances to communicate without having to _hard wire_ the port information see [docker.io's documentation on linking](http://docs.docker.io/en/latest/use/working_with_links_names/).
+
+If you wish to map these ports to specific port numbers on the host system, this can be accomplished as command line options to the `docker run` command using the _port map_ option specified using the `-p` option. The syntax for this option is documented in [docker.io's run documentation](http://docs.docker.io/en/latest/commandline/cli/#run), but is essentially `-p <host-port>:<container-port>`.
+
+
+
diff --git a/packaging/docker/base/Dockerfile b/packaging/docker/base/Dockerfile
new file mode 100644 (file)
index 0000000..881e737
--- /dev/null
@@ -0,0 +1,19 @@
+FROM ubuntu:12.04
+RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" >> /etc/apt/sources.list
+RUN apt-get update && apt-get -y upgrade
+RUN apt-get -y install openjdk-7-jre-headless unzip
+RUN mkdir -p /opt/
+ADD target/dist /opt/
+RUN unzip /opt/*.zip -d /opt
+RUN rm -rf /opt/*.zip
+# Ports 
+#    JMX:                  1088
+#    Netconf:              1830
+#    OSGi Console:         2400
+#    OpenFlow:             6633
+#    [default] Java Debug: 8000
+#    ODL Web Portal:       8080
+#    Netconf:              8383
+EXPOSE 1088 1830 2400 6633 8000 8080 8383
+WORKDIR /opt/opendaylight
+ENTRYPOINT ["/opt/opendaylight/run.sh"]
\ No newline at end of file
diff --git a/packaging/docker/base/pom.xml b/packaging/docker/base/pom.xml
new file mode 100644 (file)
index 0000000..223cf37
--- /dev/null
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <prerequisites>
+    <maven>3.0</maven>
+  </prerequisites>
+  <parent>
+    <groupId>org.opendaylight.integration</groupId>
+    <artifactId>docker</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <relativePath>../</relativePath>
+  </parent>
+  <artifactId>docker-base</artifactId>
+  <name>OpenDaylight Docker Base Edition Project</name>
+  <packaging>pom</packaging>
+   <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>2.8</version>
+        <executions>
+          <execution>
+            <id>copy-dependencies</id>
+            <phase>package</phase>
+            <goals>
+              <goal>copy</goal>
+            </goals>
+            <configuration>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>org.opendaylight.integration</groupId>
+                  <artifactId>distributions-base</artifactId>
+                  <version>0.1.0-SNAPSHOT</version>
+                  <type>zip</type>
+                  <classifier>osgipackage</classifier>
+                  <overWrite>true</overWrite>
+                  <outputDirectory>${project.build.directory}/dist</outputDirectory>
+                </artifactItem>
+              </artifactItems>
+              <!-- other configurations here -->
+              <overWriteReleases>false</overWriteReleases>
+              <overWriteSnapshots>false</overWriteSnapshots>
+              <overWriteIfNewer>true</overWriteIfNewer>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file
diff --git a/packaging/docker/pom.xml b/packaging/docker/pom.xml
new file mode 100644 (file)
index 0000000..69ccb67
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <prerequisites>
+    <maven>3.0</maven>
+  </prerequisites>
+  <groupId>org.opendaylight.integration</groupId>
+  <artifactId>docker</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <name>OpenDaylight Docker Project</name>
+  <packaging>pom</packaging>
+  <modules>
+    <module>base</module>
+    <module>serviceprovider</module>
+    <module>virtualization</module>
+  </modules>
+</project>
\ No newline at end of file
diff --git a/packaging/docker/release/Dockerfile.base b/packaging/docker/release/Dockerfile.base
new file mode 100644 (file)
index 0000000..52f30ba
--- /dev/null
@@ -0,0 +1,19 @@
+FROM ubuntu:12.04
+RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" >> /etc/apt/sources.list
+RUN apt-get update && apt-get -y upgrade
+RUN apt-get -y install openjdk-7-jre-headless unzip wget
+RUN mkdir -p /opt/
+RUN wget -q -O /opt/distribution.zip "https://nexus.opendaylight.org/service/local/artifact/maven/content?r=opendaylight.snapshot&g=org.opendaylight.integration&a=distributions-base&v=0.1.0-SNAPSHOT&c=osgipackage&p=zip"
+RUN unzip /opt/*.zip -d /opt
+RUN rm -rf /opt/*.zip
+# Ports 
+#    JMX:                  1088
+#    Netconf:              1830
+#    OSGi Console:         2400
+#    OpenFlow:             6633
+#    [default] Java Debug: 8000
+#    ODL Web Portal:       8080
+#    Netconf:              8383
+EXPOSE 1088 1830 2400 6633 8000 8080 8383
+WORKDIR /opt/opendaylight
+ENTRYPOINT ["/opt/opendaylight/run.sh"]
\ No newline at end of file
diff --git a/packaging/docker/release/Dockerfile.serviceprovider b/packaging/docker/release/Dockerfile.serviceprovider
new file mode 100644 (file)
index 0000000..5de48d1
--- /dev/null
@@ -0,0 +1,19 @@
+FROM ubuntu:12.04
+RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" >> /etc/apt/sources.list
+RUN apt-get update && apt-get -y upgrade
+RUN apt-get -y install openjdk-7-jre-headless unzip wget
+RUN mkdir -p /opt/
+RUN wget -q -O /opt/distribution.zip "https://nexus.opendaylight.org/service/local/artifact/maven/content?r=opendaylight.snapshot&g=org.opendaylight.integration&a=distributions-serviceprovider&v=0.1.0-SNAPSHOT&c=osgipackage&p=zip"
+RUN unzip /opt/*.zip -d /opt
+RUN rm -rf /opt/*.zip
+# Ports 
+#    JMX:                  1088
+#    Netconf:              1830
+#    OSGi Console:         2400
+#    OpenFlow:             6633
+#    [default] Java Debug: 8000
+#    ODL Web Portal:       8080
+#    Netconf:              8383
+EXPOSE 1088 1830 2400 6633 8000 8080 8383
+WORKDIR /opt/opendaylight
+ENTRYPOINT ["/opt/opendaylight/run.sh"]
\ No newline at end of file
diff --git a/packaging/docker/release/Dockerfile.virtualization b/packaging/docker/release/Dockerfile.virtualization
new file mode 100644 (file)
index 0000000..a015863
--- /dev/null
@@ -0,0 +1,19 @@
+FROM ubuntu:12.04
+RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" >> /etc/apt/sources.list
+RUN apt-get update && apt-get -y upgrade
+RUN apt-get -y install openjdk-7-jre-headless unzip wget
+RUN mkdir -p /opt/
+RUN wget -q -O /opt/distribution.zip "https://nexus.opendaylight.org/service/local/artifact/maven/content?r=opendaylight.snapshot&g=org.opendaylight.integration&a=distributions-virtualization&v=0.1.0-SNAPSHOT&c=osgipackage&p=zip"
+RUN unzip /opt/*.zip -d /opt
+RUN rm -rf /opt/*.zip
+# Ports 
+#    JMX:                  1088
+#    Netconf:              1830
+#    OSGi Console:         2400
+#    OpenFlow:             6633
+#    [default] Java Debug: 8000
+#    ODL Web Portal:       8080
+#    Netconf:              8383
+EXPOSE 1088 1830 2400 6633 8000 8080 8383
+WORKDIR /opt/opendaylight
+ENTRYPOINT ["/opt/opendaylight/run.sh"]
\ No newline at end of file
diff --git a/packaging/docker/serviceprovider/Dockerfile b/packaging/docker/serviceprovider/Dockerfile
new file mode 100644 (file)
index 0000000..881e737
--- /dev/null
@@ -0,0 +1,19 @@
+FROM ubuntu:12.04
+RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" >> /etc/apt/sources.list
+RUN apt-get update && apt-get -y upgrade
+RUN apt-get -y install openjdk-7-jre-headless unzip
+RUN mkdir -p /opt/
+ADD target/dist /opt/
+RUN unzip /opt/*.zip -d /opt
+RUN rm -rf /opt/*.zip
+# Ports 
+#    JMX:                  1088
+#    Netconf:              1830
+#    OSGi Console:         2400
+#    OpenFlow:             6633
+#    [default] Java Debug: 8000
+#    ODL Web Portal:       8080
+#    Netconf:              8383
+EXPOSE 1088 1830 2400 6633 8000 8080 8383
+WORKDIR /opt/opendaylight
+ENTRYPOINT ["/opt/opendaylight/run.sh"]
\ No newline at end of file
diff --git a/packaging/docker/serviceprovider/pom.xml b/packaging/docker/serviceprovider/pom.xml
new file mode 100644 (file)
index 0000000..9ac69ee
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <prerequisites>
+    <maven>3.0</maven>
+  </prerequisites>
+  <groupId>org.opendaylight.integration</groupId>
+  <artifactId>docker-serviceprovider</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <name>OpenDaylight Docker Service Provider Edition Project</name>
+  <packaging>pom</packaging>
+   <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>2.8</version>
+        <executions>
+          <execution>
+            <id>copy-dependencies</id>
+            <phase>package</phase>
+            <goals>
+              <goal>copy</goal>
+            </goals>
+            <configuration>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>org.opendaylight.integration</groupId>
+                  <artifactId>distributions-serviceprovider</artifactId>
+                  <version>0.1.0-SNAPSHOT</version>
+                  <type>zip</type>
+                  <classifier>osgipackage</classifier>
+                  <overWrite>true</overWrite>
+                  <outputDirectory>${project.build.directory}/dist</outputDirectory>
+                </artifactItem>
+              </artifactItems>
+              <!-- other configurations here -->
+              <overWriteReleases>false</overWriteReleases>
+              <overWriteSnapshots>false</overWriteSnapshots>
+              <overWriteIfNewer>true</overWriteIfNewer>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file
diff --git a/packaging/docker/virtualization/Dockerfile b/packaging/docker/virtualization/Dockerfile
new file mode 100644 (file)
index 0000000..881e737
--- /dev/null
@@ -0,0 +1,19 @@
+FROM ubuntu:12.04
+RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" >> /etc/apt/sources.list
+RUN apt-get update && apt-get -y upgrade
+RUN apt-get -y install openjdk-7-jre-headless unzip
+RUN mkdir -p /opt/
+ADD target/dist /opt/
+RUN unzip /opt/*.zip -d /opt
+RUN rm -rf /opt/*.zip
+# Ports 
+#    JMX:                  1088
+#    Netconf:              1830
+#    OSGi Console:         2400
+#    OpenFlow:             6633
+#    [default] Java Debug: 8000
+#    ODL Web Portal:       8080
+#    Netconf:              8383
+EXPOSE 1088 1830 2400 6633 8000 8080 8383
+WORKDIR /opt/opendaylight
+ENTRYPOINT ["/opt/opendaylight/run.sh"]
\ No newline at end of file
diff --git a/packaging/docker/virtualization/pom.xml b/packaging/docker/virtualization/pom.xml
new file mode 100644 (file)
index 0000000..7295b65
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <prerequisites>
+    <maven>3.0</maven>
+  </prerequisites>
+  <groupId>org.opendaylight.integration</groupId>
+  <artifactId>docker-virtualization</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <name>OpenDaylight Docker Virtualization Edition Project</name>
+  <packaging>pom</packaging>
+   <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>2.8</version>
+        <executions>
+          <execution>
+            <id>copy-dependencies</id>
+            <phase>package</phase>
+            <goals>
+              <goal>copy</goal>
+            </goals>
+            <configuration>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>org.opendaylight.integration</groupId>
+                  <artifactId>distributions-virtualization</artifactId>
+                  <version>0.1.0-SNAPSHOT</version>
+                  <type>zip</type>
+                  <classifier>osgipackage</classifier>
+                  <overWrite>true</overWrite>
+                  <outputDirectory>${project.build.directory}/dist</outputDirectory>
+                </artifactItem>
+              </artifactItems>
+              <!-- other configurations here -->
+              <overWriteReleases>false</overWriteReleases>
+              <overWriteSnapshots>false</overWriteSnapshots>
+              <overWriteIfNewer>true</overWriteIfNewer>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file