Skip to content

Laboratory User Guide

Gaetano Perrone edited this page Dec 14, 2019 · 1 revision

This guide will show you step by step how to build your docker images and create a lab.

All the steps below are shown in the following video-guides :

Build Docker images : https://www.youtube.com/watch?v=yxBbBI1VNb4&t=54s

Pushing to DockerHub and create a lab: https://www.youtube.com/watch?v=LUan5GLCJiM

  • Build Docker images

Go to Images and select Dockerfiles. Type the name of your dockerfile and click "create". Once created click on "Add files" and add all the files you need. The following code shows an example of Apache tomcat container running a web application named Mobile Shop. In this case the files to add are ATProgetto.war and AT_DB.mv.db

from tomcat:9.0-alpine
LABEL maintainer = "tutorial-app"

ADD ATProgetto.war /usr/local/tomcat/webapps/

ADD AT_DB.mv.db /usr/local/tomcat

EXPOSE 8080

CMD.["catalina.sh", "run"]

Click on "Save Image and Build"

Check if the image is correctly deployed by opening a terminal and typing docker images

If you have any problems building your image with DSP, try with the classic method. Put all the files you need inside a folder and a file named "Dockerfile" containing the previous code then run this cmd :

docker build -t myimage .

  • Pushing to DockerHub

Go to https://hub.docker.com/ and create an account. Create a public repository (it will be username/repo-name).

Open a terminal and login with your credentials.

docker login docker.io

Find the image and copy the id. Link the image with your public repo with this cmd :

docker tag "image id" "repo"

Example : docker tag d5655cf85fed traianus/mobileshoptest

Push your image by typing :

docker push "repo"

Example : docker push traianus/mobileshoptest

Try pulling the image from Dockerhub to make sure it all went well.

docker pull "repo"

Finally, find your image with docker images .

  • Create a lab

Now you can create a lab with your image. Go to DSP and click on "new lab".

Name it, click on "create" and "create docker network". You can, for example, create a host running the previous webserver.

Drag and drop the Host element on the left and place it. Click with the right button on it and go to "container". Select the image previously created. Configure host port and container port (as example 8080 and 8081). Save and start your lab. Go to loalhost/8081 and check if the apache tomcat server is running.

Obviously the example shows how to create a simple lab with an Apache Tomcat Server, but the possibilities are endless! You can try