0

跑步时

sudo APP_PORT=3001 ./vendor/bin/sail up

在终端中,我希望在http://localhost:3001. 但相反,我看到一条错误消息This page isn’t workinglocalhost didn’t send any data. ERR_EMPTY_RESPONSE

我正在使用 WSL(ubuntu)在 Windows 10 上运行 laravel 8。

我可以看到数据库和应用程序容器在 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}:8000'
        environment:
            WWWUSER: '${WWWUSER}'
            LARAVEL_SAIL: 1
            XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
            XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
        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

4

1 回答 1

1

正如@BertC 所说,我将 docker-compose.yml 中的端口行更改为 - “9192:80”,然后sail up再次运行,它工作了。谢谢@BertC

于 2021-08-27T19:26:15.773 回答