Using mysqldump command inside the Docker PHP container

929 Views Asked by At

I am new to Docker, and now I want to use spateie/laravel-backup package to backup my project and my database.

I need to run the mysqldump command inside of Php container

When I run the mysqldump command inside of DB container, I could use it properly, but I couldn't find this command inside the Php container.

It is my docker-compose.yml :

version: '2'

services:
  project-db:
    image: mariadb:10.3.35
    container_name: project-db
    volumes:
      - ./.configs/mysql_data:/var/lib/mysql
    ports:
      - "3309:3306"
    env_file:
      - ./.configs/.env.setup

  project-nginx:
    image: nginx:stable
    container_name: project-nginx
    volumes:
      - ./workspace/project/:/var/www/project/
      - ./.configs/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
    ports:
      - "80:80"
    links:
      - project-php

  project-php:
    build: .
    container_name: project-php
    volumes:
      - ./workspace/project/:/var/www/project/
      - ./.configs/php/php-ini-overrides.ini:/etc/php/7.4/fpm/conf.d/99-overrides.ini
    links:
      - project-db
0

There are 0 best solutions below