Answer the question
In order to leave comments, you need to log in
How to run artisan migration on docker-compose build?
Initialized containers, docker-compose.yml
version: '2'
services:
nginx:
build:
context: ./
dockerfile: docker/nginx.docker
volumes:
- ./:/var/www
ports:
- "8080:80"
links:
- php-fpm
php-fpm:
build:
context: ./
dockerfile: docker/php-fpm.docker
volumes:
- ./:/var/www
environment:
- "DB_PORT=3306"
- "DB_HOST=mysql"
- "REDIS_PORT=6379"
- "REDIS_HOST=redis"
links:
- mysql
- redis
mysql:
image: mysql
volumes:
- ./storage/docker/mysql:/var/lib/mysql
environment:
- "MYSQL_ROOT_PASSWORD=123456"
- "MYSQL_USER=app"
- "MYSQL_PASSWORD=123456"
- "MYSQL_DATABASE=app"
ports:
- "33061:3306"
redis:
image: redis
ports:
- "63791:6379"
Answer the question
In order to leave comments, you need to log in
It would be more correct to create a new container from the php-fpm image via docker run and run the command in it as cmd.
It is also possible in an existing one via docker exec.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question