Laravel Sail 没有在我的 macbook m1 上运行

时间:2021-07-26 18:30:02

标签: php docker laravel-8 apple-m1 laravel-sail

我尝试在 Mac M1 计算机上使用 Laravel 8 Sail。我已经成功安装了 docker 、 php 7.4 并使用 composer 安装了 Laravel。我正在尝试使用帆,但我被困在说

的部分 <块引用>

无法打开输入文件:/var/www/html/artisan

详情如下:

这里是 docker 文件:

# For more information: https://laravel.com/docs/sail
version: '3'
services:
    laravel.test:
        build:
            context: ./vendor/laravel/sail/runtimes/7.4
            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:
            - mariadb
    mariadb:
        image: 'mariadb:10'
        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:
            - 'sailmariadb:/var/lib/mysql'
        networks:
            - sail
        healthcheck:
          test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
          retries: 3
          timeout: 5s
networks:
    sail:
        driver: bridge
volumes:
    sailmariadb:
        driver: local


在我的 rosetta 终端上运行命令 ./vendor/bin/sail up 后,我收到以下错误:

laravel.test_1  | 2021-07-26 18:19:35,319 INFO Set uid to user 0 succeeded
laravel.test_1  | 2021-07-26 18:19:35,320 INFO supervisord started with pid 17
laravel.test_1  | 2021-07-26 18:19:36,332 INFO spawned: 'php' with pid 18
laravel.test_1  | Could not open input file: /var/www/html/artisan
laravel.test_1  | 2021-07-26 18:19:36,383 INFO exited: php (exit status 1; not expected)
laravel.test_1  | 2021-07-26 18:19:37,395 INFO spawned: 'php' with pid 19
laravel.test_1  | Could not open input file: /var/www/html/artisan
laravel.test_1  | 2021-07-26 18:19:37,433 INFO exited: php (exit status 1; not expected)
laravel.test_1  | 2021-07-26 18:19:39,447 INFO spawned: 'php' with pid 20
laravel.test_1  | Could not open input file: /var/www/html/artisan
laravel.test_1  | 2021-07-26 18:19:39,483 INFO exited: php (exit status 1; not expected)
laravel.test_1  | 2021-07-26 18:19:42,501 INFO spawned: 'php' with pid 21
laravel.test_1  | Could not open input file: /var/www/html/artisan
laravel.test_1  | 2021-07-26 18:19:42,538 INFO exited: php (exit status 1; not expected)
laravel.test_1  | 2021-07-26 18:19:43,543 INFO gave up: php entered FATAL state, too many start retries too quickly

1 个答案:

答案 0 :(得分:0)

多次尝试后发现共享驱动挂载有权限问题。我的项目文件夹在 Document >> LaraProjects 中。我不得不手动添加文件共享。所以这就是我所做的:

在 Docker Dashboard > settings > Resources > File Sharing 下,我点击加号添加目录并添加 Documents >> LaraProjects 并且它工作了。