紧接上文:1. Magento 本地安装指南(一)-CSDN博客

三:创建 docker compose 的构建文件

1. 创建 docker-compose.yml 文件

version: "3.9"
services:
    nginx:
        image: nginx:alpine
        ports:
            - "80:80"
        volumes:
            - type: volume
              source: wwwroot
              target: /data/wwwroot
              volume:
                  nocopy: true
            - type: bind
              source: ./nginx/conf/nginx.conf
              target: /etc/nginx/nginx.conf
            - type: bind
              source: ./nginx/conf/conf.d
              target: /etc/nginx/conf.d
        restart: always
        networks:
            - net-www
    mysql8:
        image: mysql:8
        expose:
            - "3306"
        ports:
            - "3306:3306"
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: "123456"
        networks:
            - net-www
    elasticsearch8:
        image: elasticsearch:8.11.4
        expose:
            - "9200"
        restart: always
        networks:
            - net-www
    php82:
        build:
            context: ./php82/build/
        expose:
            - "9000"
        volumes:
            - type: volume
              source: wwwroot
              target: /data/wwwroot
              volume:
                  nocopy: true
        restart: always
        command: ["php-fpm", "-R"]
        networks:
            - net-www
volumes:
    wwwroot:
        external: true
networks:
    net-www: null

2. 构建文件已上传(上方压缩包),自行下载

四:开始构建 docker

1. 在文件包的当前目录下运行命令

PS C:\Users\Administrator\Desktop\新建文件夹 (3)\magento-deployment> docker compose up -d
time="2025-01-08T20:43:57+08:00" level=warning msg="C:\\Users\\Administrator\\Desktop\\新建文件夹 (3)\\magento-deployment\\docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion"
[+] Running 0/3
 - nginx Pulling                                                                                                                                                                   9.6s 
 - mysql8 Pulling                                                                                                                                                                  9.6s 
 - elasticsearch8 Pulling                                                                                                                                                          9.6s 

未完待续...

更多推荐