乐趣区

关于docker-compose:dockercompose-入门

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
退出移动版