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 user use our predefined Odysseus Server Docker ContainerImage, 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
- Open a Terminal window.
- Type "docker"
- If Docker is already installed, a help page with common Docker options and commands will show up.
- 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.
...
Code Block | ||||
---|---|---|---|---|
| ||||
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 |
...
Create a docker image
Currently, we provide docker only for linux X86_64 based systems. The images can be used for Linux and Windows (we did not make any tests with MacOS)
If you want to create you own docker image, you can use the following dockerfile as a starting point:
Please have a look at the official docker documentation for further information about docker.
Szenario: Local Update site and other features should be installed into a docker image
Here:
- The base odysseus images is used as base image
- An own update site (e.g. created with maven) is copied to the image
- The database feature is installed from the stable update site
- From the own file based update site the sample feature is installed
Code Block |
---|
FROM odysseusol/odysseus
ADD ./de.uniol.inf.is.odysseus.sample.feature.update /de.uniol.inf.is.odysseus.sample.feature.update
RUN /usr/lib/odysseus/odysseus -application org.eclipse.equinox.p2.director -repository https |
...
://odysseus.informatik.uni-oldenburg.de/ |
...
updatesite/odysseus_all_new/stable/origin/master/latest/ -installIU de.uniol.inf.is.odysseus.database.feature.feature.group -destination /usr/lib/odysseus -profile DefaultProfile;
RUN /usr/lib/odysseus/odysseus -application org.eclipse.equinox.p2.director -repository file:///de.uniol.inf.is.odysseus.sample.feature.update -installIU de.uniol.inf.is.odysseus.sample.feature.feature.group -destination /usr/lib/odysseus -profile DefaultProfile;
EXPOSE 8888
CMD ["/usr/lib/odysseus/odysseus","-console -debug -data @noDefault"] |
Hint: To get the names of the installable units
- look at the update-site folders in the features folder
- take the full name of the feature.jar until the "_", e.g. : de.uniol.inf.is.odysseus.database.feature_1.0.0.202111142343.jar → de.uniol.inf.is.odysseus.database.feature
- append .feature.group
...
Code Block | ||||
---|---|---|---|---|
| ||||
#!/bin/sh
cd home
cd odysseus
echo "Starting Odysseus ..."
./odysseus |
- Now we want to create the Dockerfile which describes our Docker container
- Create a new file called "Dockerfile" within our "odysseusdocker"-folder (e.g. with nano again or what ever you prefer)
- Put the content from the box below into the Dockerfile
Code Block | ||||
---|---|---|---|---|
| ||||
# 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
EXPOSE 9669 |
...