...
Code Block |
---|
language | bash |
---|
title | 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
- In your Terminal window, navigate to the "odysseusdocker"-folder
- Type "sudo docker build ." (The " ." refers to the folder we are in. The command assumes a file named "Dockerfile" in that folder.)
- Wait (it will take some time to get the basis for our container: Ubuntu and Java 8)
- Now we should see a message that the container was successfully build. We can type "sudo docker images" to see our images.
Code Block |
---|
language | bash |
---|
title | Our Docker images |
---|
|
Successfully built 36d0ac65435c
tobi@tobi-VirtualBox:~/Documents/odysseusdocker$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<none> <none> 36d0ac65435c About a minute ago 950.6 MB
ubuntu 15.10 6ed4652370be 27 hours ago 136.1 MB
tobi@tobi-VirtualBox:~/Documents/odysseusdocker$ |