You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

In this guide we will show you how to create a Docker container for Odysseus. Such a container can help you to run and share Odysseus more easily. If you want to use our predefined Odysseus Server Docker Container, see Run with Docker.

Step-by-step guide

We assume that you have a Linux system up and running, e.g. Ubuntu. If you want to try it out without changing your system or if you don't have a Linux machine, we recommend VirtualBox.

Installing Docker

  1. Open a Terminal window.
  2.  Type "docker"
  3. If Docker is already installed, a help page with common Docker options and commands will show up.
  4. If not, your Terminal will probably give you a hint how to install Docker. Under Ubuntu, it is "sudo apt-get install docker.io"

Preparing the Folder

Now we need a folder where we can put everything that we need in.

  1. Create a folder, e.g. in your "Documents"-folder.
  2. Move to that folder
  3. Create another folder "odysseus" in that folder

Creating the magic folder
tobi@tobi-VirtualBox:~$ ls
Desktop  Documents  Downloads  examples.desktop  Music  Pictures  Public  Templates  Videos
tobi@tobi-VirtualBox:~$ cd Documents/
tobi@tobi-VirtualBox:~/Documents$ ls
tobi@tobi-VirtualBox:~/Documents$ mkdir odysseusdocker
tobi@tobi-VirtualBox:~/Documents$ ls
odysseusdocker
tobi@tobi-VirtualBox:~/Documents$ cd odysseusdocker/
tobi@tobi-VirtualBox:~/Documents/odysseusdocker$ mkdir odysseus

 

  1. Now we need the version from Odysseus that we want to run. We can use the Odysseus Server Version as an example.
  2. Download Odysseus Server for Linux here (we use the 64-bit version): http://odysseus.informatik.uni-oldenburg.de/index.php?id=76
  3. Unzip the content of your download to the odysseus-folder within our "odysseusdocker"-folder
  4. Create a new file in the "odysseusdocker"-folder with the name "startup.sh" and the content in the box below (e.g. with nano or some other text editor)
  5. Change the permission of the file to be executable: "chmod 744 startup.sh"
  6. With "ls -l" you can see if the file is executable

 

startup.sh
#!/bin/sh
cd home
cd odysseus
echo "Starting Odysseus ..."
./odysseus

 

  1. Now we want to create the Dockerfile which describes our Docker container
  2. Create a new file called "Dockerfile" within our "odysseusdocker"-folder (e.g. with nano again or what ever you prefer)
  3. Put the content from the box below into the Dockerfile

 

Dockerfile
 # We will use Ubuntu as our basis
FROM ubuntu:15.10
 
# We need Java 8 - install Java 8 on that Ubuntu machine
RUN apt-get update
RUN apt-get install software-properties-common -y
RUN add-apt-repository ppa:webupd8team/java -y
RUN apt-get update
RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
RUN apt-get install oracle-java8-installer -y
RUN apt-get install oracle-java8-set-default
 
# Add java to environment variables
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
 
# Start Odysseus on startup of the container
ADD startup.sh /home/startup.sh
ADD odysseus /home/odysseus
CMD ./home/startup.sh
 
# We need a port to be exposed - this is the port for the WebService from Odysseus
EXPOSE 9669

 

Now we have everything prepared in that folder.

Build and run the Docker container

  1. In your Terminal window, navigate to the "odysseusdocker"-folder
  2. Type "sudo docker build ." (The " ." refers to the folder we are in. The command assumes a file named "Dockerfile" in that folder.)
  3. Wait (it will take some time to get the basis for our container: Ubuntu and Java 8. But next time you do it it's much faster.)
  4. Now we should see a message that the container was successfully build. We can type "sudo docker images" to see our images.
Our Docker images
Successfully built 3adf9650f4ed
tobi@tobi-VirtualBox:~/Documents/odysseusdocker$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
<none>              <none>              3adf9650f4ed        9 seconds ago       950.6 MB
ubuntu              15.10               6ed4652370be        27 hours ago        136.1 MB
tobi@tobi-VirtualBox:~/Documents/odysseusdocker$ 

Now we can run the Docker container:

  1. "sudo docker run -p 127.0.0.1:9700:9669 --name our_odysseus -t 3adf9650f4ed"
Starting the container
tobi@tobi-VirtualBox:~/Documents/odysseusdocker$ sudo docker run -p 127.0.0.1:9700:9669 --name our_odysseus -t 3adf9650f4ed
Starting Odysseus ...
Odysseus:
GTK+ Version Check
0    INFO  Core  - Current size of heap:     1.0 GB - de.uniol.inf.is.odysseus.core.Activator.start(Activator.java:61) 
23   INFO  Core  - Maximum size of heap:     1.0 GB - de.uniol.inf.is.odysseus.core.Activator.start(Activator.java:64) 
26   INFO  Core  - Free memory of the heap:     879.4 MB - de.uniol.inf.is.odysseus.core.Activator.start(Activator.java:67) 
27   INFO  Core  - Running VM with:     amd64 - de.uniol.inf.is.odysseus.core.Activator.start(Activator.java:70) 
999  INFO  OdysseusConfiguration  - Read config file from /root/.odysseus/odysseus.conf - de.uniol.inf.is.odysseus.core.server.OdysseusConfiguration.loadProperties(OdysseusConfiguration.java:86) 
2662 WARN  LogicalOperatorBuilder  - URL for SetTimeProgressMarker not available! - de.uniol.inf.is.odysseus.logicaloperator.LogicalOperatorBuilder.addLogicalOperator(LogicalOperatorBuilder.java:243) 
3271 INFO  OdysseusServerApplication  - Odysseus application is fully started! - de.uniol.inf.is.odysseus.product.server.starter.OdysseusServerApplication.start(OdysseusServerApplication.java:31) 
osgi> 5353 INFO  SingleSchedulerManager  - No Scheduler-Config-File found. - de.uniol.inf.is.odysseus.scheduler.manager.singleschedulermanager.SingleSchedulerManager.activate(SingleSchedulerManager.java:113) 
5354 INFO  SingleSchedulerManager  - New Scheduler-Config-File created - de.uniol.inf.is.odysseus.scheduler.manager.singleschedulermanager.SingleSchedulerManager.activate(SingleSchedulerManager.java:126) 
5406 INFO  SingleSchedulerManager  - Active scheduler. class de.uniol.inf.is.odysseus.scheduler.singlethreadscheduler.SimpleThreadSchedulerMSLimitSourcesPerThread - de.uniol.inf.is.odysseus.scheduler.manager.singleschedulermanager.SingleSchedulerManager.activate(SingleSchedulerManager.java:137) 
7524 INFO  WebServicePublisher  - Webservice published at http://0:0:0:0:0:0:0:0:9669/odysseus - de.uniol.inf.is.odysseus.planmanagement.executor.webservice.server.WebServicePublisher.publish(WebServicePublisher.java:106) 

As you can see above, Odysseus started. We also exposed one port the the outside: port 9669 is forwarded to port 9700, wherefore we should be able to see the WebService in our host machine. Just open http://localhost:9700/odysseus?wsdl in a browser on your host machine.You should be able to see an XML-file describing the Odysseus WebService.

Some Docker management

  • See all your running containers: "sudo docker ps"
  • See all your started containers (including non-running containers): "sudo docker ps -a"
  • Stop all running containers: "sudo docker stop $(sudo docker ps -a -q)
  • Delete all started containers: "sudo docker rm $(sudo docker ps -a -q)

 

  • No labels