Reputation: 21
I have a problem with laravel sail. My problem is I can't migrate models. I used the command vendor/bin/sail artisan migrate
but the console gives me nothing, no error, It also did not create any tables in the database. When I went to the project website and tried to create a new user, I could click the migration button and everything worked. sail node --version
or similar commands also do not return anything
# For more information: https://laravel.com/docs/sail
version: '3'
services:
web:
build:
context: ./vendor/laravel/sail/runtimes/8.0
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.0/app
ports:
- '80:80'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
mysql:
image: 'mysql:8.0'
platform: linux/amd64
container_name: clinic_db
restart: unless-stopped
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
volumes:
- 'sailmysql:/var/lib/mysql'
networks:
- sail
healthcheck:
test: ["CMD", "mysqladmin", "ping"]
phpmyadmin:
image: 'phpmyadmin:latest'
ports:
- 8080:80
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
links:
- "mysql:db"
depends_on:
- mysql
networks:
- sail
networks:
sail:
driver: bridge
volumes:
sailmysql:
driver: local
Works on macbook pro m1. Can anyone fix this error?
Upvotes: 2
Views: 483
Reputation: 13416
I ran into this in my project. I had to add this to my .env
APP_SERVICE=laravel
where "laravel" was the the name of the container for the app. so in your case it would be
APP_SERVICE=web
My particular project that had the issue was an old laravel 5.7 project that we recently updated to laravel 8.x. I didn't run into this issue on newer installs. Maybe more recent versions of laravel do not need this extra .env variable?
Upvotes: 0