Laravel Sail is not working properly in Ubuntu 20.04 LTS
Stefan Izdrail
Founder & Senior Architect · 2026-06-29
Title: Troubleshooting Laravel Sail Issues on Ubuntu 20.04 LTS
Laravel Sail is a powerful tool for developing efficient local development environments with Docker. However, it's not uncommon to encounter issues when using it. In this comprehensive blog post, we will dive deep into the potential problems and solutions related to Laravel Sail on Ubuntu 20.04 LTS, ensuring you have a smoother development process.
Firstly, it is essential to ensure that your Docker installation is properly set up and running on your Ubuntu system. Docker has a complex post-installation process, which can be found at [https://docs.docker.com/engine/install/linux-postinstall/](https://laravelcompany.com/blog/troubleshooting-laravel-sail-issues-on-ubuntu-2004-lts#docker_setup).
After resolving the Docker installation, run these commands to create a Laravel project and start using Sail:
1. Create a new Laravel project with composer: `composer create-project --prefer-dist laravel/laravel blog`
2. Install Sail by adding the sail extension: `composer require laravel/sail`
3. Add this line to your .env file: `SAIL_ENV=local`
4. Run sail up command with docker-compose: `./vendor/bin/sail up --d`
**Note:** You will need to change the directory path if you moved away from the project's root folder.
With Laravel Sail started, launch your browser, and visit [http://localhost](http://localhost) to view your project. Ensure that it is functioning correctly before proceeding to explore other commands in Sail.
Now let us take a look at how to run additional artisan or sail commands without causing docker containers to close automatically:
1. Run the `sail up` command with no arguments or the `-d` flag if desired:
`./vendor/bin/sail up` or `./vendor/bin/sail up -d`
2. Use the sail shell command instead of running artisan commands directly from the terminal:
`sail shell` followed by your artisan command.
3. Double-check your current working directory when executing artisan commands outside the sail context, as they can sometimes behave differently. Use relative paths or absolute paths if needed.
4. Verify that the sail-specific binaries (vendor/bin/sail) are in your $PATH variable, allowing you to run sail commands from anywhere on the system. If not, consider adding them manually: `export PATH="$HOME/.composer/vendor/laravel/sail:$PATH"`
5. Ensure that you have enough resources available for Laravel Sail and its dependencies, such as memory, CPU power, and storage space. You may need to adjust these settings in the docker-compose.yml file or by using the `--memory`, `--cpus`, or `--storage` flags when running up commands.
Lastly, keep in mind that Laravel Sail is designed for local development environments and may not be optimized for production scenarios. However, you can still explore other alternatives if you encounter performance issues or other problems with your project. Some popular options include Valet ([https://laravel.com/docs/8.x/valet](https://laravelcompany.com/blog/troubleshooting-laravel-sail-issues-on-ubuntu-2004-lts#valet)), Laradock ([https://laradock.io](https://laravelcompany.com/blog/troubleshooting-laravel-sail-issues-on-ubuntu-2004-lts#laradock)), or using Docker directly with a custom docker-compose file.
In conclusion, troubleshooting Laravel Sail issues on Ubuntu 20.04 LTS can be a complex process but is achievable with careful consideration and the right approach. By following these tips and tricks, you will have a smoother Laravel development experience within your local environment.