Docker-Compose部署nodejs+java+mysq

2021-02-10  本文已影响0人  lenbolan
  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
上一篇下一篇

猜你喜欢

热点阅读