TP4 Docker

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

• TP 4 : Docker

• Professor: Ouassim Karrakchou


• Level : 4th year

TP 4

Docker

Objectives:
The goal of this TP is to introduce you to Docker containers and to experiment with
it.

We will do the following tasks:

• Run a Docker container.

• Build a Docker container.

• Share a Docker container image.

• Make data created by a container persistent.

Evaluation:

These TPs have two parts that are evaluated:


1. Experimental part: call the Professor to verify what you did when it tells
you to do so.
2. Assignment: an assignment needs to be done at the end of the class.
Please send it by email to your TP teacher before midnight the day of
the TP:
a. Ouassim KARRAKCHOU ouassim.karrakchou@uir.ac.ma
b. Zakaria MOHAMMADI zakariamhm@gmail.com
c. Awatif ROUIJEL awatifrouijel@gmail.com
d. Mohammed SOUIDI souididoc@gmail.com

The TP must be done in groups of 2 to 3 students. The groups must stay the same
for all the next TPs.

UIR 2023/2024 Page 1


• TP 4 : Docker
• Professor: Ouassim Karrakchou
• Level : 4th year

I- Launch the getting-started Docker image:


In this TP, we will run a container image containing a tutorial about Docker, and
then do some sections of this tutorial. The goal is to understand this tutorial and
be able to summarize the different steps you did in a document.

1. First, you have to install the Docker Desktop program from:


https://www.docker.com/products/docker-desktop/
2. Then, you have to launch the following command in a terminal to run the
getting-started Docker image:

docker run -d -p 80:80 docker/getting-started

3. Call the professor to show him when the container has run.

II- Build a Docker image:


1. Open the following website: http://localhost/

2. You should now see a tutorial containing several sections:

3. Read quickly the Getting Started section (no need to watch the video
during the TP, but you can see it at home).

4. Complete the Our Application section.

5. Call the professor to show him.

UIR 2023/2024 Page 2


• TP 4 : Docker
• Professor: Ouassim Karrakchou
• Level : 4th year

III- Update a Docker image:


1. Complete the Updating Our App section.

2. Call the professor to show him.

IV- Share a Docker image:


1. Complete the Sharing Our App section.

2. Call the professor to show him.

V- Make data created by a container persistent:


1. Complete the Persisting Our DB section.

2. Call the professor to show him.

VI- Deploy an Azure Custom Vision container and call it:


At the end of TP2, you exported your image classification model to a zip file
containing a Dockerfile (if not, you can get the zip file from here:
bananaClassifierDocker.zip). This zip file contains the code of the image classifier
you created during TP2.

1. Based on everything you learned during this TP, and looking at the
README.txt of the zip file, find how to run the image classification Docker
image locally.

2. Based on the README.txt of the zip file, check how to call the banana
classifier locally.

3. Change the API query program you wrote at the end of TP2 to now call
your local image classifier with a banana image URL from the Internet
instead of the classifier running in the Cloud. Hint: if you didn’t do it you
can use the requests python module. Check in the documentation of the
requests module how to do a Post request with custom headers. It should
look like this code template (with the … replaced by the correct code):

import requests
import json

api_url = …

headers = {

}

UIR 2023/2024 Page 3


• TP 4 : Docker
• Professor: Ouassim Karrakchou
• Level : 4th year

body = {

}

response = requests.post(…)
for prediction in response.json()["predictions"] :
print("Class: ", prediction['tagName'], ", Probability: ",
float(prediction['probability'])*100, "%")

4. Call the professor to show him.

VII- Assignment:
Based on what you learned in the TP explain the different steps needed to build a
Docker image, run it, share it, and make it persistent. Make sure to explain the
different options you use in the commands and use screenshots.

UIR 2023/2024 Page 4

You might also like