关于docker-compose:dockercompose-入门

32次阅读

共计 633 个字符,预计需要花费 2 分钟才能阅读完成。

docker-compose.yml 文件内容

version: '3.1'
services:
  mysql:
    restart: always
    image: mysql
    container_name: weiwei_mysql
    ports:
      - 3307:3306
    environment:
      MYSQL_ROOT_PASSWORD: 123456
      TZ: Asia/Shanghai
    volumes:
      - /opt/docker_mysql_tomcat/mysql_data:/var/lib/mysql
  tomcat:
    restart: always
    image: tomcat
    container_name: weiwei_tomcat
    ports:
      - 8088:8080
    environment:
      TZ: Asia/Shanghai 
    volumes:
      - /opt/docker_mysql_tomcat/tomcat_webapps:/usr/local/tomcat/webapps
      - /opt/docker_mysql_tomcat/tomcat_logs:/usr/local/tomcat/logs

创立文件夹:/opt/docker_mysql_tomcat

而后:docker-compose up -d

firewall-cmd --zone=public --list-ports
firewall-cmd --zone=public --add-port=8080/tcp —-permanent
firewall-cmd --reload

正文完
 0