Public Repository

Last pushed: a year ago
Short Description
如何使用Docker安裝CLOG
Full Description

======
Docker – Linked PHP and MySQL Containers

http://www.samueledney.com/2016/01/21/trying-out-docker-php-and-mysql/

步驟1~3可以做成docker-compose.yml 如步驟11

  1. 執行mysql
    docker run -p 3306:3306 --name mysql -v /data1:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -d mysql

  2. 執行PHP並且link mysql
    docker run -tid -p 8080:80 -v ~/www/html:/var/www/html --name appserver --link mysql:db nimmis/apache-php5

  3. 安裝phpMyadmin
    docker run --name phpmyadmin --link mysql:mysql -p 1234:80 -d nazarpc/phpmyadmin

  4. download and extrac xoops-2.5.7 and copy htdocs/* to ~/www/html

  5. 調整權限或是將/var/www/html所有檔案權限設成777
    denter appserver
    cd /var/www/html
    mv xoops_lib ../
    mv xoops_data ../

chmod 777 uploads/
chmod 777 uploads/avatars/
chmod 777 uploads/images/
chmod 777 uploads/ranks/
chmod 777 uploads/smilies/
chmod 777 ../xoops_lib/modules/protector/configs/
chmod 777 mainfile.php
chmod 777 include/license.php

chmod 777 ../xoops_data/caches
chmod 777 ../xoops_data/caches/xoops_cache
chmod 777 ../xoops_data/caches/smarty_cache
chmod 777 ../xoops_data/caches/smarty_compile
chmod 777 ../xoops_data/configs
chmod 777 ../xoops_data/data

  1. 開啟瀏覽器輸入 http://192.168.87.129:8080/ 即可開始安裝 xoops

  2. 取得mysql IP addr
    docker inspect mysql | grep IPAddress

  3. 將clog程式複製到 ~/www/html/modules中

  4. 匯入資料, 開啟瀏覽器輸入 http://192.168.87.129:1234 首先先建立資料庫clog,然後點選[匯入]後瀏覽之前備份的檔案如sap-tables_mod.sql後直接案執行

  5. 將安裝好 packages 的 Container 存成 Docker Image
    huber@ubuntu:/data1$ dk ps -a
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    9e4077700258 nazarpc/phpmyadmin "/home/entrypoint.sh" 10 hours ago Up 10 hours 0.0.0.0:1234->80/tcp phpmyadmin
    c4ebfe6929a6 nimmis/apache-php5 "/my_init" 10 hours ago Up 10 hours 0.0.0.0:8080->80/tcp appserver
    e0dab198c261 mysql "docker-entrypoint.sh" 10 hours ago Up 10 hours 0.0.0.0:3306->3306/tcp mysql

#dk commit 9e4077700258 liuhuber/phpmyadmin:clog

#dk commit c4ebfe6929a6 liuhuber/appserver:clog

#dk commit e0dab198c261 liuhuber/mysql:clog

  1. 上傳DockerHub
    #docker login
    ID/PD: liuhuber/Zaq12wsx
    Login successfully

    docker push liuhuber/mysql:clog

    docker push liuhuber/phpmyadmin:clog

    docker push liuhuber/appserver:clog

  2. 編輯 docker-compose.yml
    mysql:
    container_name: mysql
    restart: always
    image: liuhuber/mysql:clog
    ports:

    • "3306:3306"
      environment:
    • MYSQL_ROOT_PASSWORD=root
      volumes:
    • /data1:/var/lib/mysql
      appserver:
      container_name: appserver
      restart: always
      image: liuhuber/appserver:clog
      ports:
    • "8080:80"
      links:
    • mysql:db
      volumes:
    • ~/www/html:/var/www/html
      phpmyadmin:
      container_name: phpmyadmin
      restart: always
      image: liuhuber/phpmyadmin:clog
      ports:
    • "1234:80"
      links:
    • mysql:db
  3. 執行docker-compose

    cd ~/www/clog //進到docker-compose.yml放的位置

    docker-compose up

    docker-compose stop

  1. 測試
    1) XOOPS - http://192.168.87.129:8080/
    ID/PD: admin/Zaq12wsx, huber/huber, spam/ibmsap
    2) phpMyadmin - http://192.168.87.129:1234/
    ID/PD: root/root

~~~~完成

====
快速安裝

  1. 下載 docker images

    docker pull liuhuber/mysql:clog

    docker pull liuhuber/phpmyadmin:clog

    docker pull liuhuber/appserver:clog

  2. 取得 docker-compose.yml (C:\Users\IBM_ADMIN\Documents\我的技術\Docker\需求單系統)
  3. 啟動 Docker containers

    docker-compose -f ~/docker-compose.yml up -d

  4. 測試
    1) XOOPS - http://192.168.87.129:8080/
    ID/PD: admin/Zaq12wsx, huber/huber, spam/ibmsap
    2) phpMyadmin - http://192.168.87.129:1234/
    ID/PD: root/root
  5. 同時啟動五個 appserver 環境

    docker-compose scale appserver=5

  6. 停止 Containers執行

    docker-compose -f ~/docker-compose.yml stop && docker-compose -f ~/docker-compose.yml rm -f

======
安裝手冊

docker pull liuhuber/mysql:clog

docker pull liuhuber/phpmyadmin:clog

docker pull liuhuber/appserver:clog

// 取得 docker-compose.yml

docker-compose up

==================================
mysql:
container_name: mysql
restart: always
image: liuhuber/mysql:clog
ports:

- "3306:3306"

environment:

- MYSQL_ROOT_PASSWORD=root

volumes:

- /data1:/var/lib/mysql  

appserver:
container_name: appserver
restart: always
image: liuhuber/appserver:clog
ports:

- "8080:80"

links:

- mysql:db

volumes:

- ~/www/html:/var/www/html

phpmyadmin:
container_name: phpmyadmin
restart: always
image: liuhuber/phpmyadmin:clog
ports:

- "1234:80"

links:

- mysql:db  
Docker Pull Command
Owner
liuhuber

Comments (0)