laravel / sail

Docker files for running a basic Laravel application.
https://laravel.com/docs/sail
MIT License
1.68k stars 475 forks source link

ERROR: Invalid interpolation format for "laravel.test" option in service "services": "${APP_PORT:-80}:80" #625

Closed hebertcisco closed 1 year ago

hebertcisco commented 1 year ago

Sail Version

1.25

Laravel Version

10.10

PHP Version

8.2.11

Operating System

Linux

OS Version

Pop!_OS 22.04 LTS

Description

docker-compose version 1.24.0, build 0aa59064

Docker version 24.0.5, build 24.0.5-0ubuntu1~22.04.1

ERROR: Invalid interpolation format for "laravel.test" option in service "services": "${APP_PORT:-80}:80"

This occurs because the docker-compose.yml file by default is coming without the docker compose version.

services:
    laravel.test:
        build:
            context: ./vendor/laravel/sail/runtimes/8.2
            dockerfile: Dockerfile
            args:
                WWWGROUP: '${WWWGROUP}'
        image: sail-8.2/app
        extra_hosts:
            - 'host.docker.internal:host-gateway'
        ports:
            - '${APP_PORT:-80}:80'
            - '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
        environment:
            WWWUSER: '${WWWUSER}'
            LARAVEL_SAIL: 1
            XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
            XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
            IGNITION_LOCAL_SITES_PATH: '${PWD}'
        volumes:
            - '.:/var/www/html'
        networks:
            - sail
        depends_on:
            - pgsql
    pgsql:
        image: 'postgres:15'
        ports:
            - '${FORWARD_DB_PORT:-5432}:5432'
        environment:
            PGPASSWORD: '${DB_PASSWORD:-secret}'
            POSTGRES_DB: '${DB_DATABASE}'
            POSTGRES_USER: '${DB_USERNAME}'
            POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}'
        volumes:
            - 'sail-pgsql:/var/lib/postgresql/data'
            - './vendor/laravel/sail/database/pgsql/create-testing-database.sql:/docker-entrypoint-initdb.d/10-create-testing-database.sql'
        networks:
            - sail
        healthcheck:
            test:
                - CMD
                - pg_isready
                - '-q'
                - '-d'
                - '${DB_DATABASE}'
                - '-U'
                - '${DB_USERNAME}'
            retries: 3
            timeout: 5s
networks:
    sail:
        driver: bridge
volumes:
    sail-pgsql:
        driver: local

And if you try to run vendor/bin/sail up, the same error appears

I tried adding the version manually and it worked.

image

image

Did this error occur to you? Is it something that needs to be adjusted?

Steps To Reproduce

When running the php artisan sail:install command, after choosing the services to be installed, the following error is returned:

image

At this stage it is already possible to notice the error, and if you try to run the vendor/bin/sail up command the error will appear again.

jessarcher commented 1 year ago

Hi @hebertcisco,

Docker no longer supports Compose V1 so we've dropped support for it as well.

With Compose V2, the version field is no longer used. You should be able to migrate to V2 which will give you the docker compose command (instead of docker-compose) which Sail will use automatically.

https://docs.docker.com/compose/history/