I'm creating a docker image for a Laravel 10 development environment.
The docker-compose.yml is:
services:
web:
image: laravelfans/laravel
container_name: laravel
ports:
- 8000:80
At this moment, the image is created and the container is created. Typing localhost:8000 on browser, it shows me the Laravel home page.
Now, I want to map the Laravel file path inside the container (/var/www/laravel) to my local machine, so I can edit the code, using VSCode, for example. So I added the volume in docker-compose:
services:
web:
image: laravelfans/laravel
container_name: laravel
ports:
- 8000:80
volumes:
- ./src/:/var/www/laravel/
I've already tried some variations, like './src/':'/var/www/laravel/', or removing the ending bars like: './src':'/var/www/laravel'. But when the image is recreated, the container exit(1) right after the startup.
To create the image and start the container, I'm using the following:
docker compose create
docker compose up -d
What am I missing? Ty.