I’m trying out Laravel Sail, as I’ve been successfully using Laradock for a few years and hoping to simplify my dev environment setup. I am on Windows 10 64, Docker Desktop 3.0 installed using WSL 2, and my Laravel app is running Laravel 8.20.1.
In my Laravel project, I’ve followed the Laravel Sail setup guide: I’ve run composer require laravel/sail --dev
and php artisan sail:install
, and I see the docker-compose.yml
in my root directory.
But when I run ./vendor/bin/sail up
I get this error:
./vendor/bin/sail: line 1: XSym: command not found
./vendor/bin/sail: line 2: 0024: command not found
./vendor/bin/sail: line 3: a81960381c7144e16cd1e768af147de3: command not found
./vendor/bin/sail: line 4: ../laravel/sail/bin/sail: No such file or directory
Update: I fixed the above through Qumber’s help: removing /vendor/ and reinstalling. But now I get this error:
In GitBash I get this response:
Unsupported operating system [MINGW64_NT-10.0-19041]. Laravel Sail supports macOS, Linux, and Windows (WSL2).
If I try from Powershell now, I get:
/bin/bash: C:UsersssundSourcesteepdbvendorbin/../laravel/sail/bin/sail: No such file or directory
————-Requested attachments——————–
docker-compose.yml:
# For more information: https://laravel.com/docs/sail
version: '3'
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.0
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.0/app
ports:
- '${APP_PORT:-80}:80'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
- redis
# - selenium
# selenium:
# image: 'selenium/standalone-chrome'
# volumes:
# - '/dev/shm:/dev/shm'
# networks:
# - sail
mysql:
image: 'mysql:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
volumes:
- 'sailmysql:/var/lib/mysql'
networks:
- sail
redis:
image: 'redis:alpine'
ports:
- '${FORWARD_REDIS_PORT:-6379}:6379'
volumes:
- 'sailredis:/data'
networks:
- sail
# memcached:
# image: 'memcached:alpine'
# ports:
# - '11211:11211'
# networks:
# - sail
mailhog:
image: 'mailhog/mailhog:latest'
ports:
- 1025:1025
- 8025:8025
networks:
- sail
networks:
sail:
driver: bridge
volumes:
sailmysql:
driver: local
sailredis:
driver: local
Dockerfile in vendorlaravelsailruntimes7.4:
FROM ubuntu:20.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2
&& mkdir -p ~/.gnupg
&& chmod 600 ~/.gnupg
&& echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
&& apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C
&& apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C
&& echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu focal main" > /etc/apt/sources.list.d/ppa_ondrej_php.list
&& apt-get update
&& apt-get install -y php7.4-cli php7.4-dev
php7.4-pgsql php7.4-sqlite3 php7.4-gd
php7.4-curl php7.4-memcached
php7.4-imap php7.4-mysql php7.4-mbstring
php7.4-xml php7.4-zip php7.4-bcmath php7.4-soap
php7.4-intl php7.4-readline php7.4-pcov
php7.4-msgpack php7.4-igbinary php7.4-ldap
php7.4-redis
&& php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer
&& curl -sL https://deb.nodesource.com/setup_15.x | bash -
&& apt-get install -y nodejs
&& apt-get install -y mysql-client
&& apt-get -y autoremove
&& apt-get clean
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php7.4
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/7.4/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 8000
ENTRYPOINT ["start-container"]
7
Answers
Ok there were multiple things that I needed to fix here.
Once I fixed the above, I was able to open Windows Terminal, create an Ubuntu tab, and run
./vendor/bin/sail up
and it executed.You need to install linux under windows first. Your answer is correct. Thanks 🙂
For me, this was a permissions issue. Running as sudo worked.
Using Win10 with WSL Ubuntu 20.04 LTS.
If you’re like me who cloned a Laravel project from GitHub where none of the application’s Composer dependencies are available including Sail, you’ll need to run the following commands from the project directory. The following commands use a small Docker Container containing PHP and Composer to install the application’s dependencies:
Further information can be found on the Laravel documentation.
This may sound crazy, but I had the same issue.
I just did
vendor/bin/sail up
Instead of
.vendor/bin/sail up
And that worked!
I was facing this problem on my Mac .This issue is due to permission
Solution for MAC
1: Pull down the Apple menu and choose ‘System Preferences’
2: Choose “Security & Privacy” control panel
3: Now select the “Privacy” tab, then from the left-side menu select “Full Disk Access”
4:Click the lock icon in the lower left corner of the preference panel and authenticate with an admin level login
5: Now click the [+] plus button to add an application with full disk access
6:Navigate to the /Applications/Utilities/ folder and choose “Terminal” to grant Terminal with Full Disk Access privileges
7: Relaunch Terminal, the “Operation not permitted” error messages will be gone
After that you can install Laravel.
Solution for Windows 10
Find the sail file in the vendor folder: vendor/laravel/sail/bin/sail and change from this code:
to this:
then use GitBash to run commond
From Unsupported operating system Laravel 8 with Sail on Windows 10 (WSL2)