Laravel Sail with Docker and PostgreSQL support
68
Follow these 6 steps to install WSL:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
(Ensure you meet the version and build number criteria) Update to the latest Windows version in the Settings menu if needed.
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
(Choose the appropriate package based on your system type) Install the package and proceed to the next step.
wsl --set-default-version 2
Visit the Microsoft Store and select your preferred Linux distribution (e.g., Ubuntu). Launch the newly installed distribution, and create a user account and password.
Install Windows Terminal for enhanced command line functionality.
Download and run Docker Desktop Installer.
Follow the installation prompts, ensuring to select the appropriate backend option. Start Docker Desktop after successful installation.
curl -s https://laravel.build/example-app | bash
cd example-app
./vendor/bin/sail up
Optionally, create a shell alias for Sail commands.
Add to your shell configuration file (e.g., ~/.zshrc or ~/.bashrc)
alias sail='[ -f sail ] && sh sail || sh vendor/bin/sail'
Restart your shell.
sail up
sail up -d
Access the project in your browser at http://localhost
sail stop
docker-compose.yml file.If you encounter a RuntimeException like:
In order to use the Auth::routes() method, please install the laravel/ui package.
To resolve this issue, you'll need to install the laravel/ui package. This package provides a simple way to scaffold authentication views and routes.
You can install it using Composer with the following command:
composer require laravel/ui
If you receive a message like:
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Instead, it's best to run Composer as a regular user. If you need to install global packages, you can use the --global flag, but still without sudo.
Here's the proper way to install the laravel/ui package without using sudo:
composer require laravel/ui --dev
The --dev flag is optional and is used if you only need this package for development purposes. If you need it in production, you can omit this flag.
After installing the package, you can generate the necessary views and routes for authentication using Artisan:
php artisan ui bootstrap --auth
Replace Bootstrap with the front-end framework you're using (e.g., vue, react, etc.) if it's different.
This will generate the authentication views in your resources/views/auth directory, along with the necessary routes.
Remember to clear your config cache if you've previously cached it:
php artisan config:clear
After doing this, try running your Laravel application again.
If you're using Docker and Laravel Sail, you might need to rebuild your Docker containers to make sure the changes take effect:
sail down
sail up -d
Make sure to backup any important files or configurations before making these changes.
Content type
Image
Digest
sha256:71d009663…
Size
457.5 MB
Last updated
almost 3 years ago
docker pull sjwmdev/laravel-sail-pgsql:lsp-1