关于docker-compose:docker-物联网-开发

47次阅读

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

version: '3'
services:
#  vsftpd:
#    image: fauria/vsftpd
#    volumes:
#      - "/media/hdd/videos:/home/vsftpd"
#    restart: always
#    network_mode: "host"
#    ports:
#      - "20:20"
#      - "21:21"
#      - "21100-21110:21100-21110"
#    environment:
#      - FTP_USER=camera
#      - FTP_PASS=camera
#      - PASV_MIN_PORT=21100
#      - PASV_MAX_PORT=21110
#
 emqx:
  image: "emqx:4.3.22"
  container_name: "emqx"
  environment:
    - EMQX_LOADED_PLUGINS="emqx_management,emqx_auth_http,emqx_dashboard"
    - EMQX_DASHBOARD__DEFAULT_USER__LOGIN=admin
    - EMQX_DASHBOARD__DEFAULT_USER__PASSWORD=public
    - EMQX_NODE__MAX_PORTS=65535
    - EMQX_MQTT__MAX_PACKET_SIZE=16MB
  ports:
    - "18083:18083"
    - "1883:1883"
    - "8080:8081"
    - "8883:8883"
  volumes:
    - ./logs:/opt/emqx/log
    - /etc/localtime:/etc/localtime
  restart: always

 mongodb:
    image: mongo:5.0.5
    volumes:
      - "/media/hdd/mongo:/data/db"
    tty: true
    network_mode: "host"
    ports:
      - "27017:27017"
    environment:
      - MONGO_INITDB_ROOT_USERNAME=backend
      - MONGO_INITDB_ROOT_PASSWORD=backend

进入容器后

mongo admin
db.auth('backend','backend') 容器里用户名明码
use xinmier  本人建个库
db.createUser({user:'backend',pwd:'backend',roles:[{role:'userAdmin',db:'xinmier'},"readWrite"]});

正文完
 0