# 使用docker-compose建立xoops網站

在前面，已經建立apache2+php7的映像檔，我們將利用來架設 xoops 網站

建立 docker-compose.yaml

```
version: '2'

services:
  mariadb:
    container_name: xoopsDB
    image: mariadb:10
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=superuser
      - MYSQL_PASSWORD=superuser
    command: mysqld --sql_mode=""
    networks:
      vpcbr:
        ipv4_address: 10.5.0.3
    volumes:
      - /mnt/raid/web/db:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro

  xoops:
    container_name: xoops
    image: kawsing/xoops 
    ports:
     - "80:80"
     - "433:433"
    networks:
      vpcbr:
        ipv4_address: 10.5.0.2
    volumes:
      - /mnt/raid/web/xoops/www:/var/www
      - /etc/localtime:/etc/localtime:ro
    links:
     - mariadb
networks:
  vpcbr:
    driver: bridge
    ipam:
     config:
       - subnet: 10.5.0.0/24
         gateway: 10.5.0.1


```

在此目錄（xoops）下，執行 docker-compose up -d 即可自動 pull mariadb，建立xoops\_vpcbr的docker網路，完成架設xoops的環境

![](https://529150212-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lh81JtaIQ84bwQqz_Wh%2F-Lk7z76sGEfBIwBEPsSL%2F-Lk8-9H7WJP5wntK23gb%2Fimage.png?alt=media\&token=9d676ea6-d288-485f-9f5f-1906302d5372)

**於HOST中**

**sudo mkdir /mnt/raid/web/xoops/www/html**

**sudo chmod  -R 777 /mnt/raid/web/xoops/www**

**cd /mnt/raid/web/xoops/www/html**

**sudo curl -L "<https://campus-xoops.tn.edu.tw/modules/tad\\_uploader/index.php?op=dlfile\\&cfsn=149\\&cat\\_sn=11\\&name=install\\_1.3\\_20170913.zip>" -o install.zip**<br>

**sudo unzip install.zip**

啟動瀏覽器,輸入localhost

**於瀏覽器中**

**<http://ip/instal.php進行安裝xoops>**

<div align="left"><img src="https://529150212-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lh81JtaIQ84bwQqz_Wh%2F-Lk8-Q2qH8C9ENCa14ez%2F-Lk80NZlYqBV0cAQ9U8n%2Fimage.png?alt=media&#x26;token=d3720b16-f431-47fc-80f6-3c949c80f882" alt=""></div>

![](https://529150212-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lh81JtaIQ84bwQqz_Wh%2F-Lk8-Q2qH8C9ENCa14ez%2F-Lk829BPjFBAuERlRgk8%2Fimage.png?alt=media\&token=6fa55ac5-931e-49b9-994e-5549de3adb20)

**注意資料庫的IP為你在docker-compose.yaml中所設定的，非localhost**<br>

![](https://lh6.googleusercontent.com/owVnYEdGvu6bvScfMuhU2SM2lPaHTBpRXg9OBJD5ggDTFyvvZDUCGZOKv0u2A0Z1CsY0lxsj5fyyWneYkM2r_TYSFUeX8eoeut1As2srWCe3gsw5JaJQgNX2TwWs5eIGq14dqI82)

進入後台設置工作

![](https://529150212-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lh81JtaIQ84bwQqz_Wh%2F-Lk88Sf5VY5owput7ald%2F-Lk88WAp6HJvIegJVayB%2Fimage.png?alt=media\&token=94b2e332-5a08-4354-8bde-3841ea0623e5)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kawsing.gitbook.io/opensystem/docker-cong-an-zhuang-dao-ying-yong-ru-men-pian/shi-yong-dockercompose-jian-li-xoops-wang-zhan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
