01. [30p] Running a multi-container application

Subtasks
  1. based on the sources and the Dockerfile in the backend folder from the lab archive, build an image with the name lab5-api-image
  2. create a bridge network called lab5-db-network
  3. create another bridge network called lab5-adminer-network
  4. create a volume named lab5-db-volume
  5. from the parent folder of backend, launch a container in the background for a database with the following features:
    1. 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)
    2. attach the previously-created lab5-db-volume volume (as source) to the /var/lib/postgresql/data path in the running container (as destination)
    3. the container will be part the previously-created lab5-db-network network
    4. the following environment variables will be specified (in a docker run command, this is done as follows: docker run -e NAME=value):
      1. variable POSTGRES_USER with value admin
      2. variable POSTGRES_PASSWORD with value admin
      3. variable POSTGRES_DB with value books
    5. the container will be called lab5-db
    6. the container will run the postgres image from the official register
  6. add the lab5-db container to the lab5-adminer-network network
  7. launch a container in the background for a database admin with the following features:
    1. the container will expose port 8080 and map it to 8080 on the local machine
    2. the container will be called lab5-adminer
    3. the container will be part the previously-created lab5-adminer-network network
    4. the container will run the adminer image from the official register
  8. start a container in the background based on the previously-created lab5-api-image image, with the following features:
    1. the container will be part of the previously-created lab5-db-network network
    2. the following environment variables will be specified:
      1. variable PGUSER with value admin
      2. variable PGPASSWORD with value admin
      3. variable PGDATABASE with the value books
      4. variable PGHOST with value lab5-db
      5. variable PGPORT with value 5432
    3. the container will be called lab5-api
    4. the container will expose port 80 and map it to port 5555 on the local machine
ii/labs/s2/05/tasks/01.txt ยท Last modified: 2024/04/29 19:29 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