码迷,mamicode.com
首页 > 其他好文 > 详细

记录下(同一个计算机)多个容器 dockr bridge(桥接) docker-compose 配置

时间:2019-04-26 18:20:24      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:idg   exp   nbsp   usr   pre   share   ports   mon   red   

 直接上

version: ‘3‘

services:
  mysql:
    container_name: mysql
    image: mysql:5.7.21
    environment:
      MYSQL_ROOT_PASSWORD: root
    volumes:
      - ./data/mysql:/var/lib/mysql
    expose:
      - 3306
    ports:
      - 3306:3306
    networks:
      - mysql_bridge
    restart: on-failure

  redis:
    container_name: redis
    image: redis:4.0.6
    expose:
      - 6379
    ports:
      - 6379:6379
    volumes:
      - ./data/redis:/usr/share/redis/data:rw
    networks:
      - redis_bridge

  mongo:
    container_name: mongo
    image: mongo:4.0.9
    volumes:
      - ./data/mongo:/data/db
    expose:
      - 27017
    ports:
      - 27017:27017
    networks:
      - mongo_bridge
    restart: on-failure

networks:
  mysql_bridge:
    external: true
  redis_bridge:
    external: true
  mongo_bridge:
    external: true

 

记录下(同一个计算机)多个容器 dockr bridge(桥接) docker-compose 配置

标签:idg   exp   nbsp   usr   pre   share   ports   mon   red   

原文地址:https://www.cnblogs.com/zjhblogs/p/10775667.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!