laraveldockerubuntuubuntu-20.04laravel-sail

Laravel Sail is not working properly in Ubuntu 20.04 LTS


Hi i tried to install fresh Laravel project using Laravel Sail docker environment. First it was showing me "Docker is not running" error. Then i found out, i needed to start docker as rootless. I solved it, reading this url: [https://docs.docker.com/engine/install/linux-postinstall/].

After that, I successfully installed Laravel using Laravel Sail. Then I ran

./vendor/bin/sail up -d

I was able to view Laravel project in my browser. But when i ran any other artisan commands such as ./vendor/bin/sail artisan route:list or sail commands as sail shell, all the docker containers were forced closed automatically. It shows me this error.

Sail is not running.

You may Sail using the following commands: './sail up' or './sail up -d'

Any suggestions? I am getting this issue on Ubuntu 20.04 LTS version.


Solution

  • I was using Laradock before installing Laravel Sail. Maybe there were some conflicts. So I backed up all my databases, then I removed all containers using this code. sudo docker rmi -f $(docker images -a -q). Then installed fresh Laravel project and it worked.

    Please read my below comment as it is was a better solution for me.