Docker Compose使用
version: "3.0" services: redis6379: image: redis:latest container_name: redis6379 ports: - "6379:6379" #挂载配置文件 volumes: - ./redis.conf:/etc/redis/redis.conf mysql3306: image: mysql:latest container_name: mysql3306 ports: - "3306:3306" #挂载配置文件 #volumes: #- "./db:/var/lib/mysql" #- "./conf/my.cnf:/etc/my.cnf" #- "./init:/docker-entrypoint-initdb.d/" environment: MYSQL_ROOT_PASSWORD: 123456 #参数 #利用dockerfile生成image api: build: context: ./SSK_API_8004/ ####指定Dockerfile所在目录 dockerfile: Dockerfile #如果不指定,默认使用Dockerfile文件 #args: #buildno: 1 image: img_api depends_on: #依赖 - mysql3306 - redis6379 #启动容器 api8081: image: img_api container_name: api8001 ports: - "8081:80" depends_on: #依赖 - api api8082: image: img_api container_name: api8002 ports: - "8082:80" depends_on: #依赖 - api api8083: image: img_api container_name: api8003 ports: - "8083:80" depends_on: #依赖 - api api_nginx: image: nginx:latest container_name: api_nginx ports: - "80:80" #挂载配置文件 volumes: - ./api_nginx.conf:/etc/nginx/nginx.conf # ems:
喜欢 C#、SQL、Web