Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ii:labs:s2:04:tasks:01 [2022/05/18 14:20]
radu.ciobanu created
ii:labs:s2:04:tasks:01 [2024/04/11 12:44] (current)
radu.ciobanu
Line 1: Line 1:
-==== 01. [00p] Running ​a multi-container application ​====+==== 01. [20p] Running ​containers ​====
  
 == Subtasks == == Subtasks ==
  
-  - based on the sources and the Dockerfile in the //**api**// folder from the lab archive, build an image with the name **//​api-lab4-image//** +  - pull the **//busybox//** image from the official Docker registry to the local cache 
-  - create ​bridge network called ​**//lab4-db-network//** +  - run a **//busybox//** container that executes ​the **//uptime//** command 
-  - create another bridge network called **//​lab4-adminer-network//​** +  - run an interactive ​**//busybox//** container; once you enter it, run the command ​**//wget google.com//**, then exit 
-  - create a volume named **//​lab4-db-volume//​** +  - run a **//busybox//** detached interactive container (daemon); once you have started itattach to it and run the **//id//** commandthen exit 
-  - launch a container ​//**in the background**//​ for a database with the following features: +  - delete ​all containers ​and images created at the previous points
-    - a bind mount will be attached ​that will map between ​the **//./​database/​init-db.sql//** file on the local machine (this will be the source to the bind mount flag and can be found in the lab archive) and the **///​docker-entrypoint-initdb.d/​init-db.sql//​** file in the container to be run (this will be the destination) +
-    attach the previously-created **//​lab4-db-volume//​** volume (as source) to the **///​var/​lib/​postgresql/​data//​** path in the running container (as destination) +
-    - the container will be part the previously-created **//​lab4-db-network//​** and **//​lab4-adminer-network//​** networks +
-    - the following environment variables will be specified (in a **//​docker ​run//** command, this is done as follows: ​**// docker run -e NAME=value//**): +
-      - environment variable **//​POSTGRES_USER//​** with value **//​admin//​** +
-      - environment variable **//​POSTGRES_PASSWORD//​** with value **//​admin//​** +
-      - environment variable **//​POSTGRES_DB//​** with value **//​books//​** +
-    - the container you run will be called **//​lab4-db//​** +
-    - you will run the **//postgres//** image from the official register +
-  - Start container with the previously created image ** // api-laborator-1-image ​// ** in the backgroundwith the following features: +
-    - the container will run on the previously created ​** // laboratory1-db-network ​// ** network +
-    - the following environmental variables will be specified:​ +
-      - variable ** // PGUSER // ** with value ** // admin // ** +
-      - variable ** // PGPASSWORD // ** with value ** // admin // ** +
-      - variable ** // PGDATABASE // ** with the value ** // books // ** +
-      - variable ** // PGHOST // ** with value ** // laboratory1-db // ** +
-      - variable ** // PGPORT // ** with value ** // 5432 // ** +
-    - the rolled container will be called ** // laborator1-api // ** +
-    - the container will display port 80 and map it to port 5555 on the local machine. +
-  - Check that the two containers are running properly and have connectivity:​ +
-    - using [[https://​www.postman.com | Postman]] or any other similar applicationmake GET and POST requests on [[http: // localhost: 5555 / api / books]] (for a tutorial on Postman, you can enter [[https://​learning.postman.com/​docs/​getting-started/​sending-the-first-request/​|aici]]) +
-    - a JSON body with the format ''​ %% {"​title":​ "​title",​ "​author":​ "​author"​} %% ''​ is expected for POST requests +
-    - GET applications will return a list of books added by POST applications. +
-  - Verify that the volume you added keeps the data persisting:​ +
-    - stop and delete ​the two containers +
-    - restart ​the two containers with the same commands as before +
-    - send a GET request +
-    - If you set it up correctly, you will receive a list of previously added books. +
- +
-== What to upload == +
- +
-  * a screenshot showing the successful execution of the Hello World container+
ii/labs/s2/04/tasks/01.1652872839.txt.gz · Last modified: 2022/05/18 14:20 by radu.ciobanu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0