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 ...

  10. Docker入门笔记

    Docker入门笔记 随笔记录初学Docker遇到的问题, 以免下次再犯. 本机系统Ubuntu18.04 安装 Docker有2个版本 Community Edition (CE) 社区版(免费) ...

随机推荐

  1. JS代码判断IE6,IE7,IE8,IE9!

    JS代码判断IE6,IE7,IE8,IE9!2011年12月15日 星期四 14:01做网页有时候会用到JS检测IE的版本,下面是检测Microsoft Internet Explorer版本的三种代 ...

  2. Web APi之过滤器执行过程原理解析【二】(十一)

    前言 上一节我们详细讲解了过滤器的创建过程以及粗略的介绍了五种过滤器,用此五种过滤器对实现对执行Action方法各个时期的拦截非常重要.这一节我们简单将讲述在Action方法上.控制器上.全局上以及授 ...

  3. LintCode Search Insert Position

    找出指定target的位置(没有此数时为按顺序应当位置). public class Solution { /** * param A : an integer sorted array * para ...

  4. spring mvc 和junit 4集成的注意点

    常规步骤: 1.导入jar包,主要有两个,spring-test 和 junit4,主要用maven管理,直接依赖即可.可以在这个网站上进行查找或下载:http://mvnrepository.com ...

  5. 解说mysql之binlog日志以及利用binlog日志恢复数据

    众所周知,binlog日志对于mysql数据库来说是十分重要的.在数据丢失的紧急情况下,我们往往会想到用binlog日志功能进行数据恢复(定时全备份+binlog日志恢复增量数据部分),化险为夷! 废 ...

  6. Button with Hover Effect (Learned from 百度脑图)

    今天想学学PM的技能, 打开了百度脑图的网站, 看到中间那个按键的hover效果蛮好看, 遂学习一下. 效果如下: Demo 其实就是利用:before绘制了半透明白色的遮罩, 平时用transfor ...

  7. bzoj2741(分块+可持久化Trie)

    题意中文我就不说了 解析: 分块+可持久化Trie,先得到前缀异或值,插入到Trie中,然后分块,对每一块,处理出dp[i][j](i代表第几块,j代表第几个位置),dp[i][j]代表以第i块开始的 ...

  8. ThinkPHP框架设计与扩展总结

    详见:http://www.ucai.cn/blogdetail/7028?mid=1&f=5 可在线运行查看效果哦 导言:ThinkPHP框架是国内知名度很高应用很广泛的php框架,我们从一 ...

  9. docker installation on ubuntu

    Ubuntu Docker is supported on these Ubuntu operating systems: Ubuntu Xenial 16.04 (LTS) Ubuntu Trust ...

  10. .NET中的各种池

    在.NET中,常用到的池有四个:字符串拘留池.线程池 .应用程序池.数据库连接池. 字符串拘留池 在.NET中字符串是不可变对象,修改字符串变量的值会产生新的对象.为降低性能消耗及减小程序集大小,.N ...