Skip to content

Navigation Menu

Sign in
Sign up

Dependencies

Iva edited this page Aug 23, 2024 · 4 revisions
  • Configuration Refinement (Dependencies)

    • Add the definition of dependency and startup order for each container in the docker-compose.yml file as applied below:
    version: "3.8"
    services:
     nginx:
     build: requirements/nginx/.
     container_name: nginx
     restart: on-failure
     depends_on:
     - wordpress
     networks:
     - inception
     ports:
     - "443:443"
     volumes:
     - .web:/var/www/html
     wordpress:
     build: requirements/wordpress/.
     container_name: wordpress
     restart: on-failure
     depends_on:
     - mariadb
     networks:
     - inception
     expose:
     - "9000"
     volumes:
     - .web:/var/www/html
     mariadb:
     build: requirements/mariadb/.
     container_name: mariadb
     restart: on-failure
     networks:
     - inception
     expose:
     - "3306"
    networks:
     inception:
     driver: bridge

    👉🏼 After defining dependencies, the container startup order will change. If no dependencies are declared, the order followed will always be the order written in the docker-compose.yml file.
    👉🏼 Dependencies:

    • nginx: Needs PHP-FPM to process .php requests. Since PHP-FPM is in the WordPress container, nginx will depend on WordPress starting first.
    • wordpress: Needs MariaDB to manage the database present in the DB volume. Since MariaDB is in the MariaDB container, WordPress will depend on MariaDB starting first.

    ⏮️ Previous
    Next ⏭️

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /