首页 > 解决方案 > 使用 Docker Compose 部署 Laravel 网站时出错

问题描述

我尝试使用 docker-compose( docker-compose.yml ) 部署我的 Laravel 网站,一旦我运行我的 compose 文件,网站就会引发错误

could not find driver (SQL: select * from ...)

我浏览了很多文章,但找不到解决问题的方法。任何人都可以帮忙清楚吗

Docker Compose 版本:3.2 Docker 引擎版本:19.*

这是我的docker-compose.yml文件:

version: '3.2'

services:

  wserver:
    image: nginx:latest
    container_name: web-nginx
    ports:
      - 4080:80
    volumes:
      - type: bind
        source: /root/website/files
        target: /var/www/html
      - type: bind
        source: /root/website/nginx/conf.d/
        target: /etc/nginx/conf.d/

  phpweb:
    build:
        context: ./php/
    container_name: web-phpfpm
    ports:
      - 4900:9000
    volumes:
      - type: bind
        source: /root/website/files
        target: /var/www/html

  dbserver:
    image: mariadb:latest
    container_name: web-mariadb
    ports:
      - 4306:3306
    volumes:
      - type: bind
        source: /root/website/mariadb/
        target: /var/lib/mysql/
      - type: bind
        source: /root/website/mysql/mariadb.conf.d/
        target: /etc/mysql/mariadb.conf.d/
    environment:
      TZ: "Asia/Kolkata"
      MYSQL_ROOT_PASSWORD: password
      SERVICE_TAGS: dev
      SERVICE_NAME: mysql




Docker File:

FROM php:7.4-fpm

RUN docker-php-ext-install mysqli

标签: laraveldockerubuntudocker-compose

解决方案


推荐阅读