美文网首页
Docker-Compose部署nodejs+java+mysq

Docker-Compose部署nodejs+java+mysq

作者: lenbolan | 来源:发表于2021-02-10 22:05 被阅读0次
    1. docker search : 从Docker Hub查找镜像
      docker search java
      docker search node
      docker search mysql

    2. 编写 yaml 文件:

    version: "3"
    services:
      mysql:
        image: mysql:latest
        container_name: mysql
        command: --default-authentication-plugin=mysql_native_password
        restart: always
        environment:
          MYSQL_ROOT_PASSWORD: 111111
        volumes:
          - ./data:/var/lib/mysql
          - ./conf/my.cnf:/etc/my.cnf
        ports:
          - "3306:3306"
      java:
        image: java:latest
        container_name: java
        ports:
          - "8663:8663"
        depends_on:
          - mysql
        restart: always
        volumes:
          - ./conf/application.properties:/usr/local/conf/application.properties
      node:
        container_name: node
        image: node:latest
        ports:
          - "9100:9100"
        depends_on:
          - java
        restart: always
    
    1. 执行命令:
    $ docker-compose -f deploy.yaml up -d
    

    相关文章

      网友评论

          本文标题:Docker-Compose部署nodejs+java+mysq

          本文链接:https://www.haomeiwen.com/subject/wxtlxltx.html