I’ve followed this tutorial docker tutorial and it is an awesome tutorial by the way. Installed an 8 Laravel version and when I tried to run PHP artisan migrate, this problem came out:
ParseError syntax error, unexpected ')' at vendor/laravel/framework/src/Illuminate/Bus/BusServiceProvider.php:51 47▕ return new DatabaseBatchRepository( 48▕ $app->make(BatchFactory::class), 49▕ $app->make('db')->connection(config('queue.batching.database')), 50▕ config('queue.batching.table', 'job_batches'), ➜ 51▕ ); 52▕ }); 53▕ } 54▕ 55▕ /** +1 vendor frames 2 [internal]:0 ComposerAutoloadClassLoader::loadClass("IlluminateBusBusServiceProvider") +5 vendor frames 8 artisan:37 IlluminateFoundationConsoleKernel::handle(Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
And I guess this is linked to Laravel 8 when running into a Docker environment.
Let’s see the docker-compose.yaml
version: '3' networks: laravel: services: nginx: image: nginx:stable-alpine container_name: nginx ports: - "8088:80" volumes: - ./src:/var/www/html - ./nginx/default.conf:/etc/nginx/conf.d/default.conf depends_on: - php - mysql networks: - laravel mysql: image: mysql:5.7.22 container_name: mysql restart: unless-stopped tty: true ports: - "4306:3306" volumes: - ./mysql:/var/lib/mysql environment: MYSQL_DATABASE: homestead MYSQL_USER: homestead MYSQL_PASSWORD: secret MYSQL_ROOT_PASSWORD: secret SERVICE_TAGS: dev SERVICE_NAME: mysql networks: - laravel php: build: context: . dockerfile: Dockerfile container_name: php volumes: - ./src:/var/www/html ports: - "9000:9000" networks: - laravel
The Dockerfile
FROM php:7.2-fpm-alpine RUN docker-php-ext-install pdo pdo_mysql
The docker containers are up and running perfectly so what could be?
Advertisement
Answer
You need to change php version in the Dockerfile
FROM php:7.4-fpm-alpine RUN docker-php-ext-install pdo pdo_mysql