Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vincent15000's avatar

Sail and docker : git clone, impossible to use sail

Hello,

I have a Laravel project with sail and pure docker : sail for dev mode and pure docker for prod mode.

I have installed this project in a new folder on my own computer and sail and docker-compose commands work fine.

Then I have installed this project on a new computer for a dev in the team and I want to run sail commands.

But there is a problem, I get an error saying that docker doesn't run. Whereas on my own computer, if I install the project in a new folder, I can use sail without any problem.

First question : I have tried to run docker-compose, but it works only with sudo. It would be interesting to be able to use it without sudo. How to do ?

Second question : What do you suggest me to check on the new computer so that the sail command works ?

Thanks for your help.

V

0 likes
3 replies
LaryAI's avatar
LaryAI
AI
Best Answer
Level 58

Certainly! Let's address both of your questions step-by-step.

First Question: Running docker-compose without sudo

To run docker-compose (and Docker in general) without sudo, you need to add your user to the docker group. Here are the steps to do that:

  1. Create the Docker group (if it doesn't already exist):

    sudo groupadd docker
    
  2. Add your user to the Docker group:

    sudo usermod -aG docker $USER
    
  3. Log out and log back in so that your group membership is re-evaluated.

  4. Verify that you can run Docker commands without sudo:

    docker run hello-world
    

If the above steps are successful, you should be able to run docker-compose without needing sudo.

Second Question: Ensuring sail Command Works on the New Computer

Here are some steps to ensure that the sail command works on the new computer:

  1. Ensure Docker is Running: Make sure Docker is installed and running. You can check the status of Docker with:

    systemctl status docker
    
  2. Install Docker Compose: Ensure Docker Compose is installed. You can check this with:

    docker-compose --version
    
  3. Install Laravel Sail: Make sure Laravel Sail is installed as a Composer dependency in your project. You can check this in your composer.json file:

    "require-dev": {
        "laravel/sail": "^1.0"
    }
    
  4. Run Sail Commands via Composer: Use the ./vendor/bin/sail script to run Sail commands. For example:

    ./vendor/bin/sail up
    
  5. Check Docker Permissions: Ensure that the user has the necessary permissions to run Docker commands. This ties back to the first question about adding the user to the docker group.

  6. Check for Environment Variables: Ensure that the .env file is properly configured. Sometimes missing or incorrect environment variables can cause issues.

  7. Check Docker Configuration: Ensure that the docker-compose.yml file is correctly configured and that there are no syntax errors or misconfigurations.

Example Commands

Here is an example of how you might run Sail commands:

# Start the application
./vendor/bin/sail up

# Run migrations
./vendor/bin/sail artisan migrate

# Install Composer dependencies
./vendor/bin/sail composer install

By following these steps, you should be able to resolve the issues with running Docker and Sail commands on the new computer. If you encounter any specific error messages, please provide them for more detailed troubleshooting.

aruszala's avatar

@vincent15000 make sure you install "Docker Desktop" on the new dev machine. Then make sure the user is added to the docker user group. After that you'll have to log the user out and back in, or just reboot the machine.

1 like
vincent15000's avatar

@aruszala No I don't need docker desktop and it's not necessary to install the desktop version.

The problem was that I had to add myself to the docker group.

Please or to participate in this conversation.