...
Before building the image, remember that the Dockerfile begins with a local image of OpenDaylight Oxygen: onap/ccsdk-odl-oxygen-image${project.version) } (currently 0.3.0-SNAPSHOT). One can download the image from NEXUS_DOCKER_IMAGE and then rename it as a local image using the commands shown below.
Code Block |
---|
title | Pulling and Renaming the OpenDaylight Oxygen docker image |
---|
|
%: docker pull ${NEXUS_DOCKER_REPO}/onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT
0.3.0-SNAPSHOT: Pulling from onap/ccsdk-odl-oxygen-image
95871a411089: Pull complete
f7253e37cce8: Pull complete
12d05d7bd5c4: Pull complete
db27ec99c6c2: Pull complete
8fd62e3405ff: Pull complete
ce430a842b90: Pull complete
de7dcf5d4be1: Pull complete
e3de3d1054ec: Pull complete
d66bd2234856: Pull complete
6be70fc7e3a6: Pull complete
Digest: sha256:80da6c8e0f70d0dddd2be462634b297fc0dc5256cb93619b30a66441d1a89cb8
Status: Downloaded newer image for nexus3.onap.org:10001/onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT
%: docker tag ${NEXUS_DOCKER_REPO}/onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT
%: docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
onap/ccsdk-odl-oxygen-image 0.3.0-SNAPSHOT bb02ebe49933 8 hours ago 1.72GB
nexus3.onap.org:10001/onap/ccsdk-odl-oxygen-image 0.3.0-SNAPSHOT bb02ebe49933 8 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
|
One can then build the ODLSLI container giving and give it the name onap/sdnr:0.3.0-SNAPSHOTDOCK with this command.
Code Block |
---|
title | Building the ODLSLI docker image |
---|
|
%: 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 |
---|
title | Running the SDNR image for the first time |
---|
|
%: docker run --interactive --tty --publish 8484:8181 --name sdnr onap/sdnr:0.3.0-SNAPSHOT
Waiting for mysql
................................................................................................ |
SDNR will not progress if it cannot login to the MySQL server. Remember that the entry point script /opt/onap/ccsdk/bin/startODL.sh will execute and that it waits to login to the db server, as shown here.
Code Block |
---|
title | startODL.sh waits for MySQL |
---|
|
...
#
# Wait for database
#
echo "Waiting for mysql"
until mysql -h dbhost -u root -p${MYSQL_PASSWD} mysql &> /dev/null
do
printf "."
sleep 1
done
echo -e "\nmysql ready"
... |
So we want to connect SDNR to ccsdk_db_container. We can inspect the CCSDK containers to learn about their network.
Image Added
Let's shut down the ccsdk_odlsli_container to avoid conflicts.
Code Block |
---|
title | Stopping ODL containers |
---|
|
%: docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4e3ba68fb7bb nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.3-STAGING-latest "/bin/bash -c 'cd /o…" 3 days ago Up 3 days 0.0.0.0:3000->3100/tcp ccsdk_dgbuilder_container
a68fc2f266e6 nexus3.onap.org:10001/onap/ccsdk-odlsli-image:0.3-STAGING-latest "/opt/onap/ccsdk/bin…" 3 days ago Up 3 days 0.0.0.0:8383->8181/tcp ccsdk_odlsli_container
26e84acaae56 mysql/mysql-server:5.6 "/entrypoint.sh mysq…" 3 days ago Up 3 days (healthy) 0.0.0.0:32790->3306/tcp ccsdk_db_container
%: docker stop ccsdk_odlsli_container
ccsdk_odlsli_container
%: docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4e3ba68fb7bb nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.3-STAGING-latest "/bin/bash -c 'cd /o…" 3 days ago Up 3 days 0.0.0.0:3000->3100/tcp ccsdk_dgbuilder_container
26e84acaae56 mysql/mysql-server:5.6 "/entrypoint.sh mysq…" 3 days ago Up 3 days (healthy) 0.0.0.0:32790->3306/tcp ccsdk_db_container
%: docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f550d9a98fb7 onap/sdnr:0.3.0-SNAPSHOT "/bin/sh -c /opt/ona…" 10 minutes ago Exited (130) 52 seconds ago sdnr
4e3ba68fb7bb nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.3-STAGING-latest "/bin/bash -c 'cd /o…" 3 days ago Up 3 days 0.0.0.0:3000->3100/tcp ccsdk_dgbuilder_container
a68fc2f266e6 nexus3.onap.org:10001/onap/ccsdk-odlsli-image:0.3-STAGING-latest "/opt/onap/ccsdk/bin…" 3 days ago Exited (137) 9 seconds ago ccsdk_odlsli_container
26e84acaae56 mysql/mysql-server:5.6 "/entrypoint.sh mysq…" 3 days ago Up 3 days (healthy) 0.0.0.0:32790->3306/tcp ccsdk_db_container
%: |