Docker Compose文件详解 V2
container_name: my-web-container- docker-compose up,启动web服务之前、启动redis、db。
- docker-compose up web,启动web容器时,检查依赖depends_on的配置内容,先启动db和redis
- redis
db:
image: postgres
- 8.8.8.8
- 9.9.9.9
dns_search
Custom DNS search domains. Can be a single value or a list.
- dc1.example.com
- dc2.example.com
tmpfs:
- /run
- /tmp
entrypoint: /code/entrypoint.shentrypoint:
- php
- -d
- zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so
- -d
- memory_limit=-1
- vendor/bin/phpunitenv_file: .env
env_file:
- ./common.env
- ./apps/web.env
- SHOW=true - SESSION_SECRETexpose:
- "3000"
- "8000"--add-host parameter.extra_hosts:
- "somehost:162.242.195.82"
/etc/hosts:
162.242.195.82
somehost
50.31.209.229 otherhostimage: redis
image: ubuntu:14.04image: tutum/influxdb
image: example-registry.com:4000/postgresql
image: a4bc65fdlabels:
com.example.description: "Accounting webapp"
com.example.department: "Finance"
com.example.label-with-empty-value: ""
labels:
- "com.example.description=Accounting webapp"
- "com.example.department=Finance"
- "com.example.label-with-empty-value"
syslog-address: "tcp://192.168.0.42:123"net
net: "bridge"
net: "host"
net: "none"
net: "container:[service name or container name/id]"network_mode
network_mode: "bridge"
network_mode: "host"
network_mode: "none"
network_mode: "service:[service name]"
network_mode: "container:[container name/id]"networks
Version 2 file format only. In version 1, use net.
networks key.pid: "host"ports:
- "3000"
- "3000-3005"
- "8000:8000"
- "9090-9091:8080-8081"
- "49100:22"
- "127.0.0.1:8001:8001"
- "127.0.0.1:5000-5010:5000-5010"volumes:
# Just specify a path and let the Engine create a volume
- /var/lib/mysql
# Specify an absolute path mapping
- /opt/data:/var/lib/mysql
# Path on the host, relative to the Compose file
- ./cache:/tmp/cache
# User-relative path
- ~/configs:/etc/configs/:ro
# Named volume
# datavolume是通过docker volume create --name datavolume创建
volume_driver.例如rancher的convoy fs。volume_driver: mydriver
ro)或读写 (rw). 如果不设置,默认为读写模式。Note: The Container:... formats are only supported in the version 2 file format. In version 1, you can use container names without marking them as such:
- service_name
- service_name:ro
- container_name
- container_name:rwcpu_shares, cpu_quota, cpuset, domainname, hostname, ipc,
mac_address, mem_limit, memswap_limit, privileged, read_only, restart,
shm_size, stdin_open, tty, user, working_dir
driver: foobarYou can also specify the name of the volume separately from the name used to refer to it within the Compose file:
Docker Compose文件详解 V2的更多相关文章
- 附005.Docker Compose文件详解
一 Docker Compose文件简介 compose文件使用yml格式,主要分为了四个区域: version:用于指定当前docker-compose.yml语法遵循哪个版本 services:服 ...
- 附003.Docker Compose命令详解
一 Docker Compose命令格式 Usage: docker-compose [-f <arg>...] [options] [COMMAND] [ARGS...] docker- ...
- Docker Compose配置文件详解(V3)
Docker Compose配置文件是Docker Compose的核心,用于定义服务.网络和数据卷.格式为YAML,默认路径为./docker-compose.yml,可以使用.yml或.yaml扩 ...
- Docker Compose 配置文件详解
先来看一份 docker-compose.yml 文件,不用管这是干嘛的,只是有个格式方便后文解说: version: '2' services: web: image: dockercloud/he ...
- docker entrypoint入口文件详解
docker entrypoint入口文件详解 pasting Dockerfile创建自定义Docker镜像以及CMD与ENTRYPOINT指令的比较 [k8s]args指令案例-彻底理解docke ...
- Docker学习(六)——Dockerfile文件详解
Docker学习(六)--Dockerfile文件详解 一.环境介绍 1.Dockerfile中所用的所有文件一定要和Dockerfile文件在同一级父目录下,可以为Dockerfile父目录的子目录 ...
- k8s之yaml文件详解
k8s之yaml文件详解 目录 k8s之yaml文件详解 1. k8s支持的文件格式 2. YAML语言格式 3. 查看api资源版本标签 4. 编写nginx-test.yaml资源配置清单 4.1 ...
- web.xml文件详解
web.xml文件详解 Table of Contents 1 listener. filter.servlet 加载顺序 2 web.xml文件详解 3 相应元素配置 1 listener. f ...
- Linux中/proc目录下文件详解
转载于:http://blog.chinaunix.net/uid-10449864-id-2956854.html Linux中/proc目录下文件详解(一)/proc文件系统下的多种文件提供的系统 ...
随机推荐
- windows LARGE_INTEGER 错误码输出格式
如果是负数,I32X 版权声明:本文为博主原创文章,未经博主允许不得转载.
- 【pwnable.kr】 flag
pwnable从入门到放弃 第四题 Download : http://pwnable.kr/bin/flag 下载下来的二进制文件,对着它一脸懵逼,题目中说是逆向题,这我哪会啊... 用ida打开看 ...
- linux提交代码到github
1.首先你得注册个github账户 .... 2.新建项目(可以选择私有或者公开的) 3.上述github代码仓库建立好了 ,就回到自己的linux服务器 3.1 在自己的项目目录里 qi 3.1. ...
- 发送邮件的几种方法(C#发邮件 和 js前台实现都有)C#后台自动发邮件 js发邮件
1.后台自动发邮件 1)首先设置邮件参数,这里写在configuration里面 <appSettings> <add key="SMTP" value=&quo ...
- qt 程序发布打包
1. 首先把 release 版本的 exe 复制到其他文件夹,比如 Desktop\test 2. 使用开始菜单中 qt 里面的控制台窗口,使用 cd 命令打开到 Desktop\test 位置,然 ...
- C#类、对象、方法和属性详解
C#类.对象.方法和属性详解 一.相关概念: 1.对象:现实世界中的实体(世间万物皆对象) 2.类:具有相似属性和方法的对象的集合 3.面向对象程序设计的特点:封装 继承 多态 4.对象的三要素:属性 ...
- redis(五)---- 简单消息队列
消息队列一个消息的链表,是一个异步处理的数据处理引擎.不仅能够提高系统的负荷,还能够改善因网络阻塞导致的数据缺失.一般用于邮件发送.手机短信发送,数据表单提交.图片生成.视频转换.日志储存等. red ...
- 51nod 1346:递归
1346 递归 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 收藏 关注 函数f(n,m) { 若n=1或m=1返回a[n][m]; 返回f(n-1,m)异或 ...
- Cordova搭建环境与问题小结
1.Cordova介绍: Apache Cordova是一套设备API,允许移动应用的开发者使用JavaScript来访问本地设备的功能,比如摄像头.加速计.它可以与UI框架(如jQuery Mobi ...
- Filter过滤器技术详解
前言 有这样一个常见的开发场景,我们编写一套系统,或者分析一套系统如何实现的过程中,我们肯定会发现这套系统的拦截机制.比如说京东或者淘宝之类的,存在这种拦截机制,这套拦截机制能够过滤掉哪些错误的登录注 ...