Mariadb Tomcat Docker環境

這是一個docker-compose,整合Mariadb、phpMyAdmin、tomcat的Docker環境

如何執行

  • 安裝docker-ce及docker-compose
  • 進入專案目錄編譯及啟動docker
    sudo docker-compose up -d –build
  • 利用phpMyAdmin回復資料庫(選擇)
  • 建置及編譯成war檔放置tomcat-webapps目錄
  • 瀏覽http://yourip:8080/warFileName

docker的相關資訊

  • mariadb:latest
  • phpmyadmin/phpmyadmin:latest
  • tomcat:8.5.49-jkd8-openjdk

預設資訊

  • tomcat manager 帳號及密碼 admin / mypassword112233
  • mariadb root 預設密碼 myadmin123
  • phpMyAdmin 預設連接埠 8088
  • tomcat 預設連接埠 8080 ;AJP 連接埠 8009
  • tomcat工作目錄是專案 tomcat-webapps

jenkins Agent docker

其它

https://github.com/catyku/MariadbPhpMyAdminTomcat

version: "3.5"

services:
  #postgres service
  mariadb:
    container_name: mariadb_container
    build: ./mariadb
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-myadmin123}
      MYSQL_DATABASE: myNameDB
 
    volumes:
      - ./mariadb-data:/var/lib/mysql
      # - ./backup/data.backup:/data/data.backup
    networks:
      myNet: 
        ipv4_address: 172.16.238.10
    restart: unless-stopped
 #localhost:5050
  phpmyadmin:
    container_name: phpmyadmin_container
    build: ./phpmyadmin
    environment:
      PMA_HOST: mariadb
      #PMA_ARBITRARY: 1

    ports:
      - "${ADMIN_PORT:-8088}:80"
    networks:
      myNet: 
        ipv4_address: 172.16.238.11
    restart: unless-stopped
    depends_on: 
      - mariadb 
  tomcat:
    container_name: tomcat8.5
    build: ./tomcat
    ports:
      - "${TOMCAT_PORT:-8080}:8080"
      - "${TOMCAT_AJP:-8009}:8009"
    volumes:
      - ./tomcat-webapps:/usr/local/tomcat/webapps
    networks:
      myNet: 
        ipv4_address: 172.16.238.12
    restart: unless-stopped

networks:
  myNet:
    ipam: 
      driver: default
      config:
        - subnet: "172.16.238.0/24"

#volumes:
  #  postgres:
 # pgadmin:
#  webapps:./tomcat-webapps

發表迴響