Sep 13, 2024
0
Level 63
Docker containers depending on other containers
Hello,
I have a problem to run some artisan commands while installing the container.
Here is an extract of the docker-compose configuration file.
appkey:
build:
context: .
dockerfile: ./docker-services/php.dockerfile
container_name: app-appkey
volumes:
- .:/var/www/html
command: ["php", "/var/www/html/artisan", 'key:generate']
working_dir: /var/www/html
depends_on:
php:
condition: service_started
vendor:
condition: service_completed_successfully
migrations:
build:
context: .
dockerfile: ./docker-services/php.dockerfile
container_name: app-migrations
volumes:
- .:/var/www/html
command: ["php", "/var/www/html/artisan", 'migrate']
working_dir: /var/www/html
depends_on:
php:
condition: service_started
vendor:
condition: service_completed_successfully
mariadb:
condition: service_healthy
seeder:
build:
context: .
dockerfile: ./docker-services/php.dockerfile
container_name: app-seeder
volumes:
- .:/var/www/html
command: ["php", "/var/www/html/artisan", 'db:seed', '--class=PersonalSeeder']
working_dir: /var/www/html
depends_on:
php:
condition: service_started
vendor:
condition: service_completed_successfully
mariadb:
condition: service_healthy
migrations:
condition: service_completed_successfully
I get this error.
ERROR: for seeder Container "047dcc932f8d" exited with code 1. ERROR: Encountered errors while bringing up the project.
I have checked, the database is not created.
So the problem is with the migrations container.
What is wrong in my docker-compose configuration ?
Thanks for your help.
V
Please or to participate in this conversation.