Can you share your DockerFile
Mar 23, 2024
13
Level 1
Sail Cannot be run on localhost
Hey there I was building laravel using sail. I set docker and everything I need to run on project. When I start sail using sail up -d command it's show started fine but I cannot see laravel application on localhost instead into docker log i see error:
024-03-23 15:47:11 2024-03-23 09:47:11,879 INFO Set uid to user 0 succeeded
2024-03-23 15:47:11 2024-03-23 09:47:11,914 INFO supervisord started with pid 1
2024-03-23 15:47:12 2024-03-23 09:47:12,930 INFO spawned: 'php' with pid 9
2024-03-23 15:47:13 2024-03-23 09:47:13,937 INFO success: php entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-03-23 15:47:18 2024-03-23 09:47:18,145 INFO exited: php (exit status 1; not expected)
2024-03-23 15:47:19 2024-03-23 09:47:19,155 INFO spawned: 'php' with pid 10
2024-03-23 15:47:19 2024-03-23 09:47:19,309 INFO exited: php (exit status 1; not expected)
2024-03-23 15:47:20 2024-03-23 09:47:20,314 INFO spawned: 'php' with pid 11
2024-03-23 15:47:20 2024-03-23 09:47:20,453 INFO exited: php (exit status 1; not expected)
2024-03-23 15:47:22 2024-03-23 09:47:22,458 INFO spawned: 'php' with pid 12
2024-03-23 15:47:22 2024-03-23 09:47:22,568 INFO exited: php (exit status 1; not expected)
2024-03-23 15:47:25 2024-03-23 09:47:25,578 INFO spawned: 'php' with pid 13
2024-03-23 15:47:25 2024-03-23 09:47:25,691 INFO exited: php (exit status 1; not expected)
2024-03-23 15:47:26 2024-03-23 09:47:26,693 INFO gave up: php entered FATAL state, too many start retries too quickly
2024-03-23 15:47:25 Could not open input file: /var/www/html/artisan
my docker-compose.yml file:
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.3
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.3/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
IGNITION_LOCAL_SITES_PATH: '${PWD}'
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
- redis
mysql:
image: 'mysql/mysql-server:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_ROOT_HOST: '%'
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 1
volumes:
- 'sail-mysql:/var/lib/mysql'
- './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
networks:
- sail
healthcheck:
test:
- CMD
- mysqladmin
- ping
- '-p${DB_PASSWORD}'
retries: 3
timeout: 5s
redis:
image: 'redis:alpine'
ports:
- '${FORWARD_REDIS_PORT:-6379}:6379'
volumes:
- 'sail-redis:/data'
networks:
- sail
healthcheck:
test:
- CMD
- redis-cli
- ping
retries: 3
timeout: 5s
networks:
sail:
driver: bridge
volumes:
sail-mysql:
driver: local
sail-redis:
driver: local
my project location inside /var/www/php/company/[example-project].
Please help me with fix the issue
Please or to participate in this conversation.