I notice you have APP_URL=http://localhost:8080 but according to your docker compose file, its port 80
APP_URL=http://localhost
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hey Folks
I'm trying to get an existing project to spin up with Laravel Sail on WSL - Docker is set up and running ok - I have spun up the getting started project from my WSL terminal and all is good
My YAML file is as follows:
# For more information: https://laravel.com/docs/sail
version: '3'
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.1
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.1/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
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:
- 'sailmysql:/var/lib/mysql'
networks:
- sail
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
retries: 3
timeout: 5s
networks:
sail:
driver: bridge
volumes:
sailmysql:
driver: local
My .env
APP_ENV=local
APP_KEY=base64:ZPiMYybIEP8PlZgevJ3Z5i8iocxtpkd9gmetDro2W6M=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost:8080
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=sail
DB_PASSWORD=password
DB_CONNECTION_TESTING=mysql
DB_HOST_TESTING=mysql
DB_PORT_TESTING=3306
DB_DATABASE_TESTING=homestead_testing
DB_USERNAME_TESTING=sail
DB_PASSWORD_TESTING=password
BROADCAST_DRIVER=pusher
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_CONNECTION=database
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
The error I'm getting is the following:
./.env: line 7: $'\r': command not found
./.env: line 14: $'\r': command not found
./.env: line 21: $'\r': command not found
./.env: line 29: $'\r': command not found
./.env: line 38: $'\r': command not found
./.env: line 43: $'\r': command not found
./.env: line 46: $'\r': command not found
./.env: line 52: $'\r': command not found
./.env: line 56: $'\r': command not found
./.env: line 60: $'\r': command not found
./.env: line 62: $'\r': command not found
./.env: line 65: $'\r': command not found
./.env: line 68: $'\r': command not found
./.env: line 70: $'\r': command not found
./.env: line 72: $'\r': command not found
./.env: line 74: $'\r': command not found
./.env: line 78: $'\r': command not found
./.env: line 81: $'\r': command not found
1 error(s) decoding:
* error decoding 'Ports': Invalid hostPort: 8080
1 error(s) decoding:
* error decoding 'Ports': Invalid hostPort: 8080
If any one has any experience with this I would welcome a solution
Please or to participate in this conversation.