...
The "docker" profile defines an additional phase in which the docker image is built and deployed to NEXUS_DOCKER_REPO with the image name ${image.name}:${project.docker.latesttag.version}, which currently translates to "onap/ccsdk-odlsli-image:0.3-STAGING-latest." I expect that the "docker build profile" in the pom.xml file requires special privileges because it deploys the image to NEXUS_DOCKER_REPO.
The Dockerfile
We have seen how the pom.xml file create the ~/ccsdk/distribution/odlsli/target/docker-stage directory in preparation for building the docker image. The next step is to inspect the Dockerfile that creates the image, discussed here.
Building the docker image
...
Running the ODLSLI pom.xml file
Running the command "mvn clean process-sources" will create the correct file and folder structure in .One can now navigate to to the ~/ccsdk/distribution/odlsli/target/docker-stage . One can navigate to that folder directory and build the docker image as shown below.One can then build the ODLSLI container and give it here. We tag the image with the name onap/sdnr:0.3.0-SNAPSHOT with this command.
Code Block | ||
---|---|---|
| ||
%: pwd
~/git/ccsdk/distribution/odlsli/target/docker-stage
%: docker build --tag onap/sdnr:0.3.0-SNAPSHOT .
Sending build context to Docker daemon 55.83MB
Step 1/21 : FROM onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT
---> bb02ebe49933
Step 2/21 : MAINTAINER CCSDK Team (onap-ccsdk@lists.onap.org)
---> Running in 53c7a075af9e
Removing intermediate container 53c7a075af9e
---> 9a53d8633de9
Step 3/21 : ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
---> Running in fc2c568526be
Removing intermediate container fc2c568526be
---> 15899d4e7cc9
Step 4/21 : ENV ODL_HOME /opt/opendaylight
---> Running in 615c57b21e5f
Removing intermediate container 615c57b21e5f
---> a64fa9d9330c
Step 5/21 : ENV SDNC_CONFIG_DIR /opt/onap/ccsdk/data/properties
---> Running in 89dc0febedb7
Removing intermediate container 89dc0febedb7
---> ca823ba18f85
Step 6/21 : ENV CCSDK_SLI_CORE_REPO mvn:org.onap.ccsdk.sli.core/ccsdk-sli-core-all/0.3.0-SNAPSHOT/xml/features
---> Running in 8ea3b1ecefc9
Removing intermediate container 8ea3b1ecefc9
---> c786ac0d9a80
Step 7/21 : ENV CCSDK_SLI_ADAPTORS_REPO mvn:org.onap.ccsdk.sli.adaptors/ccsdk-sli-adaptors-all/0.3.0-SNAPSHOT/xml/features
---> Running in aabf49f35e52
Removing intermediate container aabf49f35e52
---> 910373c6697f
Step 8/21 : ENV CCSDK_SLI_NORTHBOUND_REPO mvn:org.onap.ccsdk.sli.northbound/ccsdk-sli-northbound-all/0.3.0-SNAPSHOT/xml/features
---> Running in 6501bdd82056
Removing intermediate container 6501bdd82056
---> 7b0d785416d8
Step 9/21 : ENV CCSDK_SLI_PLUGINS_REPO mvn:org.onap.ccsdk.sli.plugins/ccsdk-sli-plugins-all/0.3.0-SNAPSHOT/xml/features
---> Running in 47475306a7bd
Removing intermediate container 47475306a7bd
---> 701ef990e4be
Step 10/21 : ENV ANSIBLE_GPG_KEY 93C4A3FD7BB9C367
---> Running in 57f328a63e52
Removing intermediate container 57f328a63e52
---> 3d9bfd557bdc
Step 11/21 : COPY idmlight.db.mv.db $ODL_HOME/data
---> c9cc49e5e720
Step 12/21 : COPY system /tmp/system
---> 896e83ab462d
Step 13/21 : RUN rsync -a /tmp/system $ODL_HOME && rm -rf /tmp/system
---> Running in 3dc894642df7
Removing intermediate container 3dc894642df7
---> 08607a4ce498
Step 14/21 : RUN cp $ODL_HOME/etc/org.apache.karaf.features.cfg $ODL_HOME/etc/org.apache.karaf.features.cfg.orig
---> Running in 2693ca9a78ad
Removing intermediate container 2693ca9a78ad
---> 9bd7f358f988
Step 15/21 : RUN cat $ODL_HOME/etc/org.apache.karaf.features.cfg.orig | sed -e "\|featuresRepositories|s|$|, ${CCSDK_SLI_CORE_REPO}, ${CCSDK_SLI_ADAPTORS_REPO}, ${CCSDK_SLI_NORTHBOUND_REPO}, ${CCSDK_SLI_PLUGINS_REPO}|" > $ODL_HOME/etc/org.apache.karaf.features.cfg
---> Running in c146dfabcba8
Removing intermediate container c146dfabcba8
---> 0998b89e66b1
Step 16/21 : RUN echo featuresBoot=config,standard,region,package,kar,ssh,management,odl-restconf-all,odl-mdsal-all,odl-mdsal-apidocs,odl-daexim-all,ccsdk-sli-core-all,ccsdk-sli-adaptors-all,ccsdk-sli-northbound-all,ccsdk-sli-plugins-all >> $ODL_HOME/etc/org.apache.karaf.features.cfg
---> Running in 3734bb36ecf4
Removing intermediate container 3734bb36ecf4
---> 9136e8973268
Step 17/21 : RUN useradd odl
---> Running in 4133971b9022
Removing intermediate container 4133971b9022
---> ba1a79490ec7
Step 18/21 : COPY opt /opt
---> 9cee59b90658
Step 19/21 : COPY org.ops4j.pax.logging.cfg /opt/opendaylight/etc/org.ops4j.pax.logging.cfg
---> 2988c82b7851
Step 20/21 : ENTRYPOINT /opt/onap/ccsdk/bin/startODL.sh
---> Running in d71effd4e8dc
Removing intermediate container d71effd4e8dc
---> 0fc9beea32f3
Step 21/21 : EXPOSE 8181
---> Running in 654509364e8f
Removing intermediate container 654509364e8f
---> f5aa4c5644d0
Successfully built f5aa4c5644d0
Successfully tagged onap/sdnr:0.3.0-SNAPSHOT
gc731h@ant-vm-45/docker-stage 84338: docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
onap/sdnr 0.3.0-SNAPSHOT f5aa4c5644d0 48 seconds ago 1.8GB
onap/ccsdk-odl-oxygen-image 0.3.0-SNAPSHOT bb02ebe49933 9 hours ago 1.72GB
nexus3.onap.org:10001/onap/ccsdk-odl-oxygen-image 0.3.0-SNAPSHOT bb02ebe49933 9 hours ago 1.72GB
nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image 0.3-STAGING-latest eb208aa7f163 4 days ago 1.04GB
nexus3.onap.org:10001/onap/ccsdk-odlsli-image 0.3-STAGING-latest 665a42becd61 4 days ago 1.8GB
mysql/mysql-server 5.6 8d97ef4de156 3 months ago 226MB
%: |
We are now in a position to run the image. Let's give it a try. The command below runs the image with the name "onap/sdnr:0.3.0-SNAPSHOT" in an interactive mode in a terminal session and maps the host port 8484 to the container port 8181. Recall that the previous ODLSLI container that we created uses port 8383 on the local host, so we use a different port.
Code Block | ||
---|---|---|
| ||
%: docker run --interactive --tty --publish 8484:8181 --name sdnr onap/sdnr:0.3.0-SNAPSHOT
Waiting for mysql
................................................................................................ |
226MB
%: |
We are now in a position to run the image. First, we shut down We shut down the ccsdk_odlsli_container to avoid conflicts.
...
We now have the information we need to start the container and use the command described here to launch it.
Alternatively, one can edit the docker-compose.yml file to use the newly created onap/sndr:0.3.0-SNAPSHOT image rather than ${NEXUS_DOCKER_REPO}/onap/ccsdk-odlsli-image:${CCSDK_DOCKER_IMAGE_VERSION}. That will also create and launch the new SDNR container.
Creating the zip installation files for karaf features
...