This shows you the differences between two versions of the page.
ii:labs:s2:05:tasks:01 [2024/04/29 18:42] radu.ciobanu |
ii:labs:s2:05:tasks:01 [2025/05/21 08:38] (current) florin.stancu [01. [30p] Running a multi-container application] |
||
---|---|---|---|
Line 3: | Line 3: | ||
== Subtasks == | == Subtasks == | ||
- | - based on the sources and the Dockerfile in the //**backend**// folder from the lab archive, build an image with the name **//lab4-api-image//** | + | - based on the sources and the Dockerfile in the //**backend**// folder from the lab archive, build an image with the name **//lab5-api-image//** |
- | - create a bridge network called **//lab4-db-network//** | + | - create a bridge network called **//lab5-db-network//** |
- | - create another bridge network called **//lab4-adminer-network//** | + | - create another bridge network called **//lab5-adminer-network//** |
- | - create a volume named **//lab4-db-volume//** | + | - create a volume named **//lab5-db-volume//** |
- from the parent folder of //**backend**//, launch a container //**in the background**// for a database with the following features: | - from the parent folder of //**backend**//, launch a container //**in the background**// for a database with the following features: | ||
- a bind mount will be attached that will map between the **//%%"%%$(pwd)%%"%%/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) | - a bind mount will be attached that will map between the **//%%"%%$(pwd)%%"%%/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) | + | - attach the previously-created **//lab5-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//** network | + | - the container will be part the previously-created **//lab5-db-network//** network |
- the following environment variables will be specified (in a **//docker run//** command, this is done as follows: **// docker run -e NAME=value//**): | - the following environment variables will be specified (in a **//docker run//** command, this is done as follows: **// docker run -e NAME=value//**): | ||
- variable **//POSTGRES_USER//** with value **//admin//** | - variable **//POSTGRES_USER//** with value **//admin//** | ||
- variable **//POSTGRES_PASSWORD//** with value **//admin//** | - variable **//POSTGRES_PASSWORD//** with value **//admin//** | ||
- variable **//POSTGRES_DB//** with value **//books//** | - variable **//POSTGRES_DB//** with value **//books//** | ||
- | - the container will be called **//lab4-db//** | + | - the container will be called **//lab5-db//** |
- the container will run the **//postgres//** image from the official register | - the container will run the **//postgres//** image from the official register | ||
- | - add the **//lab4-db//** container to the **//lab4-adminer-network//** network | + | - add the **//lab5-db//** container to the **//lab5-adminer-network//** network |
- launch a container //**in the background**// for a database admin with the following features: | - launch a container //**in the background**// for a database admin with the following features: | ||
- | - the container will expose port 8080 and map it to 8080 on the local machine | + | - the container will expose port 80 and map it to 8080 on the local machine |
- | - the container will be called **//lab4-adminer//** | + | - the container will be called **//lab5-adminer//** |
- | - the container will be part the previously-created **//lab4-adminer-network//** network | + | - the container will be part the previously-created **//lab5-adminer-network//** network |
- the container will run the **//adminer//** image from the official register | - the container will run the **//adminer//** image from the official register | ||
- | - start a container //**in the background**// based on the previously-created **//lab4-api-image//** image, with the following features: | + | - start a container //**in the background**// based on the previously-created **//lab5-api-image//** image, with the following features: |
- | - the container will be part of the previously-created **//lab4-db-network//** network | + | - the container will be part of the previously-created **//lab5-db-network//** network |
- the following environment variables will be specified: | - the following environment variables will be specified: | ||
- variable **//PGUSER//** with value **//admin//** | - variable **//PGUSER//** with value **//admin//** | ||
- variable **//PGPASSWORD//** with value **//admin//** | - variable **//PGPASSWORD//** with value **//admin//** | ||
- variable **//PGDATABASE//** with the value **//books//** | - variable **//PGDATABASE//** with the value **//books//** | ||
- | - variable **//PGHOST//** with value **//lab4-db//** | + | - variable **//PGHOST//** with value **//lab5-db//** |
- variable **//PGPORT//** with value **//5432//** | - variable **//PGPORT//** with value **//5432//** | ||
- | - the container will be called **//lab4-api//** | + | - the container will be called **//lab5-api//** |
- the container will expose port 80 and map it to port 5555 on the local machine | - the container will expose port 80 and map it to port 5555 on the local machine | ||