Docker Compose (Docker Stack)

image: Specify the image to start the container from. Can either be a repository/tag or a partial image ID.
If the image does not exist, Compose attempts to pull it, unless you have also specified build, in which case it builds it using the specified options and tags it with the specified tag.

deploy: (resource limits) This only takes effect when deploying to a swarm with docker stack deploy, and is ignored by docker-compose up and docker-compose run.

depends_on: Express dependency between services. Service dependencies cause the following behaviors:

networks: Networks to join, referencing entries under the top-level networks key.

ports: (Port mapping) Either specify both ports (HOST:CONTAINER), or just the container port (an ephemeral host port is chosen).

environment: Environment variables with only a key are resolved to their values on the machine Compose is running on, which can be helpful for secret or host-specific values.
environment:
- SHOW=true
- SESSION_SECRET

volumes: bind mount, named volume
When you use a bind mount, a file or directory on the host machine is mounted into a container. The file or directory is referenced by its absolute path on the host machine. By contrast, when you use a volume, a new directory is created within Docker's storage directory on the host machine, and Docker manages that directory's contents. Volumes have several advantages over bind mounts.
The source of the mount. For bind mounts, this is the path to the file or directory on the Docker daemon host. May be specified as source or src.
The destination takes as its value the path where the file or directory is mounted in the container. May be specified as destination, dst, or target.

logging: The default driver json-file, has options to limit the amount of logs stored. To do this, use a key-value pair for maximum storage size and maximum number of files:
options:
max-size: "200k"
max-file: "10"
The example shown above would store log files until they reach a max-size of 200kB, and then rotate them. As logs grow beyond the max limits, older log files are removed to allow storage of new logs.

docker-stack.yml

# docker stack deploy -c docker-stack.yml

version: "3.5"
x-logging:
&graylog-logging
driver: gelf
options:
gelf-address: "udp://graylog-svc:12201" x-default-logging:
&default-logging
driver: json-file x-deploy:
&default-limits
resources:
limits:
memory: 256M x-environment:
&rcs-config-server-url
RCS_CONFIG_SERVER_URL=http://config-server:19050/config services:
redis:
image: "redis:latest"
# logging: *graylog-logging
deploy: *default-limits
networks:
- outside
ports:
- "6379:6379"
volumes:
- /u/docker/redis/config:/usr/local/etc/redis # service name: prime_config-server
config-server:
image: "dck0.prime/prime-rcs-config-server:${RCS_CONFIG_VERSION:-0.0.1-SNAPSHOT}"
# logging: *graylog-logging
deploy: *default-limits
networks:
- outside
ports:
- "19050:19050"
environment:
- RCS_CONFIG_SERVER_LOCATION=file:/assert/config
- RCS_KEYSTORE_LOCATION=file:/assert/server.jks
- RCS_KEYSTORE_ALIAS=sz-qa-env
env_file: "$HOME/.ssh/rcs_keystore.env"
volumes:
- ./server.jks:/assert/server.jks:/ro
- ~/workspace/devops/prime-config/qa/qa:/assert/config/:/ro pmc-backend:
image: "dck0.prime/prime-management-console:${PMC_BACKEND_VERSION:-0.0.1-SNAPSHOT}"
# logging: *graylog-logging
deploy: *default-limits
depends_on:
- config-server
- redis
networks:
- outside
ports:
- "8283:8283"
environment:
- PMC_CONFIG_CLIENT_URL=http://config-server:19050/config
- PMC_CONFIG_CLIENT_PROFILE=qa
- LOGBACK_LOGSTASH_URL=10.102.129.23:5044
- APM_AGENT_ACTIVE=true
volumes:
- /u/docker/nginx/html/logs/pmc:/prime/logs/pmc
- /u/docker/nginx/html/upload:/opt/pmc/upload mission-mgr:
image: "dck0.prime/prime-rcs-mission:${RCS_MISSION_VERSION:-0.0.1-SNAPSHOT}"
# logging: *graylog-logging
deploy: *default-limits
depends_on:
- config-server
networks:
- outside
ports:
- "19030:19030"
- "16002:16002"
environment:
- *rcs-config-server-url
- RCS_CONFIG_CLIENT_PROFILE=qa
- LOGBACK_LOGSTASH_URL=10.102.129.23:5044
- APM_AGENT_ACTIVE=true
- JPDA_ADDRESS=16002
- JPDA_TRANSPORT=dt_socket
volumes:
- /u/docker/nginx/html/logs/rcs:/rcs/logs
- /u/docker/rcs/mission/script:/rcs/uploads/mission-script traffic-mgr:
image: "dck0.prime/prime-rcs-traffic-manager:${RCS_TRAFFIC_VERSION:-0.0.1-SNAPSHOT}"
# logging: *graylog-logging
deploy: *default-limits
depends_on:
- config-server
networks:
- outside
ports:
- "19090:19090"
- "16001:16001"
environment:
- *rcs-config-server-url
- RCS_CONFIG_CLIENT_PROFILE=qa
- LOGBACK_LOGSTASH_URL=10.102.129.23:5044
- APM_AGENT_ACTIVE=true
- JPDA_ADDRESS=16001
- JPDA_TRANSPORT=dt_socket
volumes:
- /u/docker/nginx/html/logs/rcs:/rcs/logs battery-mgr:
image: "dck0.prime/prime-rcs-battery-manager:${RCS_BATTERY_VERSION:-0.0.1-SNAPSHOT}"
# logging: *graylog-logging
deploy: *default-limits
depends_on:
- config-server
networks:
- outside
ports:
- "19040:19040"
environment:
- *rcs-config-server-url
- RCS_CONFIG_CLIENT_PROFILE=qa
- LOGBACK_LOGSTASH_URL=10.102.129.23:5044
- APM_AGENT_ACTIVE=true
volumes:
- /u/docker/nginx/html/logs/rcs:/rcs/logs simulator-mgr:
image: "dck0.prime/prime-rcs-simulator:${RCS_SIMULATOR_VERSION:-0.0.1-SNAPSHOT}"
# logging: *graylog-logging
deploy: *default-limits
depends_on:
- config-server
networks:
- outside
ports:
- "18010:18010"
environment:
- *rcs-config-server-url
- RCS_CONFIG_CLIENT_PROFILE=qa
- LOGBACK_LOGSTASH_URL=10.102.129.23:5044
- APM_AGENT_ACTIVE=true
volumes:
- /u/docker/nginx/html/logs/rcs:/rcs/logs error-mgr:
image: "dck0.prime/prime-rcs-error:${RCS_SIMULATOR_VERSION:-0.0.1-SNAPSHOT}"
# logging: *graylog-logging
deploy: *default-limits
depends_on:
- config-server
networks:
- outside
ports:
- "18040:18040"
environment:
- *rcs-config-server-url
- RCS_CONFIG_CLIENT_PROFILE=qa
- LOGBACK_LOGSTASH_URL=10.102.129.23:5044
- APM_AGENT_ACTIVE=true
volumes:
- /u/docker/nginx/html/logs/rcs:/rcs/logs eshelf-mgr:
image: "dck0.prime/prime-rcs-eshelf:${RCS_ESHELF_VERSION:-0.0.1-SNAPSHOT}"
# logging: *graylog-logging
deploy: *default-limits
depends_on:
- config-server
networks:
- outside
ports:
- "19110:19110"
environment:
- *rcs-config-server-url
- RCS_CONFIG_CLIENT_PROFILE=qa
volumes:
- /u/docker/nginx/html/logs/rcs:/rcs/logs path-plan:
image: "dck0.prime/prime-rcs-path-plan:${RCS_PATH_PLAN_VERSION:-0.0.1-SNAPSHOT}"
# logging: *graylog-logging
deploy: *default-limits
networks:
- outside
ports:
- "18020:80"
environment:
- RCS_MISSION_SERVER=http://mission-mgr:19030
volumes:
- /u/docker/nginx/html/logs/rcs:/RcsPathPlan/logs ticket-mgr:
image: "dck0.prime/prime-web-service:latest"
# logging: *graylog-logging
deploy: *default-limits
networks:
- outside
ports:
- "3000:3000" # prime-rcs-authentication:
# image: "dck0.prime/prime-rcs-authentication:0.0.1-SNAPSHOT"
# # logging: *graylog-logging
# deploy: *default-limits
# networks:
# - outside
# ports:
# - "8090:8090" # prime-rcs-auth2-web:
# image: "dck0.prime/prime-rcs-auth2-web:0.0.1-SNAPSHOT"
# # logging: *graylog-logging
# deploy: *default-limits
# networks:
# - outside
# ports:
# - "8091:8091" asc-bridge:
image: "dck0.prime/prime-asc-bridge:1.0-SNAPSHOT"
# logging: *graylog-logging
deploy: *default-limits
depends_on:
- config-server
networks:
- outside
ports:
- "19080:19080"
volumes:
- /u/docker/nginx/html/logs/rcs:/rcs/logs
environment:
- *rcs-config-server-url
- RCS_CONFIG_CLIENT_PROFILE=qa
- LOGBACK_LOGSTASH_URL=10.102.129.23:5044 networks:
outside:
external: true
name: qa-subnet

Docker Stack 笔记的更多相关文章

  1. Docker Stack 学习笔记

    该文为<深入浅出Docker>的学习笔记,感谢查看,如有错误,欢迎指正 一.简介 Docker Stack 是为了解决大规模场景下的多服务部署和管理,提供了期望状态,滚动升级,简单易用,扩 ...

  2. docker stack 部署 mssql

    =============================================== 2019/12/8_第1次修改                       ccb_warlock == ...

  3. Docker学习笔记 — 配置国内免费registry mirror

    Docker学习笔记 — 配置国内免费registry mirror Docker学习笔记 — 配置国内免费registry mirror

  4. docker学习笔记1 -- 安装和配置

    技术资料 docker中文官网:http://www.docker.org.cn/ 中文入门课程:http://www.docker.org.cn/book/docker.html docker学习笔 ...

  5. Docker学习笔记之一,搭建一个JAVA Tomcat运行环境

    Docker学习笔记之一,搭建一个JAVA Tomcat运行环境 前言 Docker旨在提供一种应用程序的自动化部署解决方案,在 Linux 系统上迅速创建一个容器(轻量级虚拟机)并部署和运行应用程序 ...

  6. docker~学习笔记索引

    回到占占推荐博客索引 使用docker也有段时间了,写了不少文章与总结,下面把它整理个目录出来,方便大家去学习与检索! docker~学习笔记索引 docker~linux下的部署和基本命令(2017 ...

  7. Docker Stack 集群部属服务

    Docker越来越成熟,功能也越来越强大.使用Dokcer Stack做服务集群也是非常的方便,docker 自己就提供了负载功能,感觉很方便,就想给大家分享一下,做一个简单的教程. 环境 我是用了两 ...

  8. Docker学习笔记 - Docker容器内部署redis

    Docker学习笔记(2-4)Docker应用实验-redist server 和client的安装使用 一.获取redis容器(含客户端和服务端) 二.创建服务端容器 1.在终端A中运行redis- ...

  9. docker学习笔记(一)—— ubuntu16.04下安装docker

    docker学习笔记(一)—— ubuntu16.04下安装docker 原创 2018年03月01日 14:53:00 标签: docker / ubuntu 1682 本文开发环境为Ubuntu ...

随机推荐

  1. Oracle数据库添加约束

    主键约束(两个特性)1:主键必须写2:主键不可重复 create table stu01( sid varchar(100), sname varchar2(100) --constraint PK_ ...

  2. 通俗理解线性回归(Linear Regression)

    线性回归, 最简单的机器学习算法, 当你看完这篇文章, 你就会发现, 线性回归是多么的简单. 首先, 什么是线性回归. 简单的说, 就是在坐标系中有很多点, 线性回归的目的就是找到一条线使得这些点都在 ...

  3. 性能测试1:loadrunner介绍及代理录制

    一.安装loadrunner lr安装环境要求: Lr11只支持ie9及一下,火狐30以下,不支持chrome.  操作系统只支持到win7.Lr打开时必须用管理员身份打开 在虚拟机中安装的win7, ...

  4. ui自动化--xpath

    xpath //*代表从根节点,查找所有匹配到的元素.在filepath中输入后回车,会发现整个页面所有元素都被虚线选中 //表示跟节点 []代表要用属性定位 @表示要用什么属性 定位完成后,对应页面 ...

  5. burpsuite破解版2.0.11下载和部署

    Burpsuite破解版下载: 链接:https://pan.baidu.com/s/1qVdrCogMN5OrEa8_zrXcEg 提取码:k7cb 一.安装步骤: 1.双击打开注册机 2.点击Ru ...

  6. 深入分析Linux内核链表

    1. 普通单链表 2. 内核链表 上图是本人从其他博客盗来的,差点被糊弄过去. 下图是本人自己用KeyNote画的(唉!!画图真的是让人心好累啊!!). 差异是不是很明显啊?! Read The Fu ...

  7. Mysql 多表连查 xml写法 非注解形式

    1.xml写法 <!-- 联查用户users表 --> <resultMap type="nanh.entity.Tasks" id="selectTa ...

  8. 【python】列表与数组之间的相互转换

    安装numpy pip3 install numpy 列表转数组 np.array() import numpy as np a = [1, 2, 3] b = np.array(a) 列表转数组 a ...

  9. openstack核心组件——cinder存储服务(11)

    一.cinder 介绍:   理解 Block Storage 操作系统获得存储空间的方式一般有两种: 通过某种协议(SAS,SCSI,SAN,iSCSI 等)挂接裸硬盘,然后分区.格式化.创建文件系 ...

  10. Thread、ThreadLocal源码解析

    今天来看一下Thread和ThreadLocal类的源码. 一.Thread (1)首先看一下线程的构造方法,之后会说每种参数的用法,而所有的构造函数都会指向init方法 //空构造创建一个线程 Th ...