2

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

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

以下是详细信息:

这是泊坞窗文件:

# 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
4

1 回答 1

0

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

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

于 2021-07-29T06:38:22.073 回答